Newer Version Available

This content describes an older version of this product. View Latest

PlatformEventChannel

Represents a collection of entities selected for Change Data Capture notifications in the Change Data Capture page in Salesforce. Change Data Capture sends notifications for created, updated, deleted, and undeleted records for the selected entities only. This type extends the Metadata metadata type and inherits its fullName field.

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 PlatformEventChannel​SelectedEntity[] A list of event names of entities, including standard and custom objects, selected for Change Data Capture notifications.
channelType PlatformEventChannel​Type (enumeration of type string) Required. The channel type. Valid values are:
  • data—Change Data Capture channel corresponding to the selected entities.
  • event—Reserved for future use.
label string Required. The channel label. The only supported value is ChangeEvents.

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 destructiveChange.xml. To update Change Data Capture selections, deploy an updated PlatformEventChannel definition or use the updateMetadata() call.

Declarative Metadata Sample Definition

The following is an example of a PlatformEventChannel component with 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>

The following is an example package.xml that 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>45.0</version>
8</Package>