Newer Version Available
PlatformEventChannel
File Suffix and Directory Location
PlatformEventChannel components have the suffix .platformEventChannel and are stored in the platformEventChannels folder.
Version
PlatformEventChannel components are available in API version 45.0 and later.
Special Access Rules
You must have the Customize Application permission to deploy and retrieve this type.
Fields
| Field Name | Field Type | Description |
|---|---|---|
| channelMembers | PlatformEventChannelSelectedEntity[] | A list of event names of entities, including standard and custom objects, selected for Change Data Capture notifications. |
| channelType | PlatformEventChannelType (enumeration of type string) | Required. The channel type. Valid values are:
|
| label | string | Required. The channel label. |
PlatformEventChannelSelectedEntity
| Field Name | Field Type | Description |
|---|---|---|
| selectedEntity | string | Required. The event name of an entity selected for Change Data Capture notifications. For example, for the Account standard object, the name is AccountChangeEvent, or for a custom object MyObject__c, the name is MyObject__ChangeEvent. |
Usage
The createMetadata() and deleteMetadata() calls aren’t supported with the PlatformEventChannel metadata type. Also, you can't delete all Change Data Capture selections by deploying with destructiveChanges.xml. To update Change Data Capture selections, deploy an updated PlatformEventChannel definition or use the updateMetadata() call.
Declarative Metadata Sample Definition for the Standard Channel
This example of a PlatformEventChannel component for the standard ChangeEvents channel contains the event names of three selected entities: Account, Contact, and the Employee__c custom object.
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 <channelMembers>
10 <selectedEntity>Employee__ChangeEvent</selectedEntity>
11 </channelMembers>
12 <channelType>data</channelType>
13 <label>ChangeEvents</label>
14</PlatformEventChannel>This package.xml references the previous definition.
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3 <types>
4 <members>ChangeEvents</members>
5 <name>PlatformEventChannel</name>
6 </types>
7 <version>46.0</version>
8</Package>Declarative Metadata Sample Definition for a Custom Channel
This example of a PlatformEventChannel component for a custom channel called SalesEvents contains the event names of three related sales objects: Account, Contact, and Order.
1<?xml version="1.0" encoding="UTF-8"?>
2<PlatformEventChannel xmlns="http://soap.sforce.com/2006/04/metadata">
3 <label>Custom Channel for Sales Events</label>
4 <channelMembers>
5 <selectedEntity>AccountChangeEvent</selectedEntity>
6 </channelMembers>
7 <channelMembers>
8 <selectedEntity>ContactChangeEvent</selectedEntity>
9 </channelMembers>
10 <channelMembers>
11 <selectedEntity>OrderChangeEvent</selectedEntity>
12 </channelMembers>
13 <channelType>data</channelType>
14</PlatformEventChannel>This package.xml references the previous definition.
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>46.0</version>
8</Package>Wildcard Support in the Manifest File
To deploy or retrieve all custom channels, specify the wildcard character * (asterisk) in the <members> field. The wildcard character isn’t supported for the standard channel.
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>46.0</version>
8</Package>