PlatformEventChannel
ファイルのサフィックスおよびディレクトリの場所
PlatformEventChannel コンポーネントのサフィックスは .platformEventChannel で、platformEventChannels フォルダに保存されます。
バージョン
PlatformEventChannel コンポーネントは、API バージョン 45.0 以降で使用できます。
特別なアクセスルール
この型をリリースおよび取得するには、「アプリケーションのカスタマイズ」権限が必要です。
項目
| 項目名 | 項目の型 | 説明 |
|---|---|---|
| channelMembers | PlatformEventChannelSelectedEntity[] | 削除済み。標準オブジェクトとカスタムオブジェクトを含む、変更データキャプチャ通知に選択されたエンティティのイベント名のリスト。 |
| channelType | PlatformEventChannelType (string 型の列挙) | 必須。チャネル種別。有効な値は、次のとおりです。
|
| label | string | 必須。チャネルの表示ラベル。 |
PlatformEventChannelSelectedEntity
| 項目名 | 項目の型 | 説明 |
|---|---|---|
| selectedEntity | string | 必須。変更データキャプチャ通知に選択されたエンティティのイベント名。たとえば、Account 標準オブジェクトの場合、名前は AccountChangeEvent、MyObject__c カスタムオブジェクトの場合、名前は MyObject__ChangeEvent です。 |
使用方法
PlatformEventChannel メタデータ型では createMetadata() および deleteMetadata() コールはサポートされていません。
API バージョン 47.0 以降では、ChangeEvents 標準チャネルをリリースまたは取得することはできません。
ChangeEvents 標準チャネルを destructiveChanges.xml で削除することはできませんが、destructiveChanges.xml で PlatformEventChannelMember 型を使用することでチャネルメンバーを削除できます。
カスタムチャネルの宣言的なメタデータの定義のサンプル
PlatformEventChannel コンポーネントには、カスタムチャネルの表示ラベルとチャネル種別が含まれます。
1<?xml version="1.0" encoding="UTF-8"?>
2<PlatformEventChannel xmlns="http://soap.sforce.com/2006/04/metadata">
3 <channelType>data</channelType>
4 <label>Custom Channel for Sales Events</label>
5</PlatformEventChannel>この package.xml は、以前の定義を参照します。カスタムチャネル名は SalesEvents__chn です。
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3 <types>
4 <members>SalesEvents__chn</members>
5 <name>PlatformEventChannel</name>
6 </types>
7 <version>47.0</version>
8</Package>マニフェストファイル内のワイルドカードのサポート
すべてのカスタムチャネルをリリースまたは取得するには、<members> 項目でワイルドカード文字の * (アスタリスク) を指定します。
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3 <types>
4 <members>*</members>
5 <name>PlatformEventChannel</name>
6 </types>
7 <version>47.0</version>
8</Package>以前のバージョンからバージョン 47.0 以降へのアップグレード
API バージョン 47.0 以降では、PlatformEventChannel 型から channelMembers 項目が削除されています。その結果、以前のバージョンで作成されている PlatformEventChannel コンポーネントを、新しい API バージョンを使用してリリースすることはできません。ただし、それらを作成したのと同じ API バージョンであればリリースできます。
API バージョン 47.0 以降を使用してカスタムチャネルコンポーネントをリリースするには、<channelMembers> 項目を削除することで PlatformEventChannel 定義をアップグレードしてください。ChangeEvents 標準チャネルはリリースも取得もできませんので、PlatformEventChannel 定義ファイルを削除してください。
たとえば、SalesEvents__chn というカスタムチャネルが API バージョン 46.0 のカスタムチャネル定義であるとします。
1<?xml version="1.0" encoding="UTF-8"?>
2<PlatformEventChannel xmlns="http://soap.sforce.com/2006/04/metadata">
3 <channelMembers>
4 <selectedEntity>AccountChangeEvent</selectedEntity>
5 </channelMembers>
6 <channelMembers>
7 <selectedEntity>ContactChangeEvent</selectedEntity>
8 </channelMembers>
9 <channelType>data</channelType>
10 <label>Sales Events</label>
11</PlatformEventChannel>バージョン 47.0 以降にアップグレードするには、このカスタムチャネル定義を、チャネルメンバーを一切含まない次の定義と置き換えます。
1<?xml version="1.0" encoding="UTF-8"?>
2<PlatformEventChannel xmlns="http://soap.sforce.com/2006/04/metadata">
3 <channelType>data</channelType>
4 <label>SalesEvents__chn</label>
5</PlatformEventChannel>カスタムまたは標準 ChangeEvents チャネルに含まれていた各チャネルメンバーに対しては、PlatformEventChannelMember メタデータコンポーネントを追加します。また、package.xml ファイルでは、PlatformEventChannel コンポーネントと PlatformEventChannelMember コンポーネントの両方を参照します。
たとえば、AccountChangeEvent メンバーに対しては、次の PlatformEventChannelMember コンポーネントを追加します。
1<?xml version="1.0" encoding="UTF-8"?>
2<PlatformEventChannelMember xmlns="http://soap.sforce.com/2006/04/metadata">
3 <eventChannel>SalesEvents__chn</eventChannel>
4 <selectedEntity>AccountChangeEvent</selectedEntity>
5</PlatformEventChannelMember>詳細は、PlatformEventChannelMember を参照してください。