Newer Version Available

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

PlatformEventChannelMember

Represents an entity selected for Change Data Capture notifications on a standard or custom channel, or a platform event selected on a custom channel.
This type extends the Metadata metadata type and inherits its fullName field.

File Suffix and Directory Location

PlatformEventChannelMember components have the suffix .platformEventChannelMember and are stored in the platformEventChannelMembers folder.

Version

PlatformEventChannelMember components are available in API version 47.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
enrichedFields EnrichedField[] One or more fields selected for Change Data Capture Enrichment. A non-empty enriched field is added to an update or delete change event even when not changed. For more information, see Enrich Change Events with Extra Fields When Subscribed with CometD in the Change Data Capture Developer Guide. Available in API version 51.0 and later.
eventChannel string Required. The name of a channel. For the standard channel, the name is ChangeEvents. For a custom channel, the name is in this format: MyChannel__chn.
filterExpression string

An expression that is used to filter the stream of events and deliver only the events that match specific criteria. The filter expression can contain one or more field-value expressions. The filter expression format is based on SOQL and supports a subset of SOQL operators and field types.

For example, this filter expression delivers only events that contain the City__c field with a value of 'San Francisco'. City__c = 'San Francisco'

For more information, see Filter Your Stream of Platform Events with Custom Channels in the Platform Events Developer Guide and Filter Your Stream of Change Events with Channels in the Change Data Capture Developer Guide. Available in API version 56.0 and later.

selectedEntity string Required. The change 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.

EnrichedField

A field selected on PlatformEventChannelMember for Change Data Capture Enrichment. A non-empty enriched field is added to an update or delete change event even when not changed.

Field Name Field Type Description
name string The name of a field selected to enrich change events with.

Usage

The createMetadata() and deleteMetadata() calls aren’t supported with the PlatformEventChannelMember metadata type.

To delete a channel member from a channel, deploy destructiveChanges.xml for this type and specify the full name of the member.

Declarative Metadata Sample Definition

This PlatformEventChannelMember component represents the selection of the Lead change event as part of the Change Data Capture selections (the standard ChangeEvents channel).

1<?xml version="1.0" encoding="UTF-8"?>
2<PlatformEventChannelMember xmlns="http://soap.sforce.com/2006/04/metadata">
3    <eventChannel>ChangeEvents</eventChannel>
4    <selectedEntity>LeadChangeEvent</selectedEntity>
5</PlatformEventChannelMember>

The file name of the example component is ChangeEvents_LeadChangeEvent.platformEventChannelMember. The file name, without the extension, corresponds to the component full name (ChangeEvents_LeadChangeEvent).

Note

If the channel has more than one selected entity, each entity is represented separately by a PlatformEventChannelMember component. For example, this component is a second member of the standard ChangeEvents channel and represents the Contact change event.

1<?xml version="1.0" encoding="UTF-8"?>
2<PlatformEventChannelMember xmlns="http://soap.sforce.com/2006/04/metadata">
3    <eventChannel>ChangeEvents</eventChannel>
4    <selectedEntity>ContactChangeEvent</selectedEntity>
5</PlatformEventChannelMember>

This example is a selected entity on the SalesEvents__chn custom channel.

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>ContactChangeEvent</selectedEntity>
5</PlatformEventChannelMember>

This example shows one enriched field, Phone, for a selected entity on the SalesEvents__chn custom channel. Enriched fields are supported in API version 51.0 and later.

1<?xml version="1.0" encoding="UTF-8"?>
2<PlatformEventChannelMember xmlns="http://soap.sforce.com/2006/04/metadata">
3    <enrichedFields>
4        <name>Phone</name>
5    </enrichedFields>
6    <eventChannel>SalesEvents__chn</eventChannel>
7    <selectedEntity>ContactChangeEvent</selectedEntity>
8</PlatformEventChannelMember>

This example shows a filter expression for a ContactChangeEvent selected entity on the SalesEvents__chn custom channel.

1<?xml version="1.0" encoding="UTF-8"?>
2<PlatformEventChannelMember xmlns="http://soap.sforce.com/2006/04/metadata">
3    <eventChannel>SalesEvents__chn</eventChannel>
4    <filterExpression><![CDATA[(Region__c='AMER')]]></filterExpression>
5    <selectedEntity>ContactChangeEvent</selectedEntity>
6</PlatformEventChannelMember>

Underscores in Channel Member Full Names

Two consecutive underscores in full names designate either a component name suffix or a namespace prefix. In all other cases, two consecutive underscores aren’t supported in full names. If your channel member name contains a custom channel name to make it unique, ensure to replace the double underscores in the name with one underscore. For example, the member name would be SalesEvents_chn_AccountChangeEvent and not SalesEvents__chn_AccountChangeEvent.

Referencing Channel Members and Channels in Package.xml

This manifest file references the example definitions on the ChangeEvents standard channel. It lists each member in the <members> field of PlatformEventChannelMember. The <members> field contains the channel member full name in this format: ChannelName_EventName.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>ChangeEvents_LeadChangeEvent</members>
5        <members>ChangeEvents_ContactChangeEvent</members>
6        <name>PlatformEventChannelMember</name>
7    </types>
8    <version>64.0</version>
9</Package>

This manifest file references members of the SalesEvents__chn custom channel.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>SalesEvents_chn_AccountChangeEvent</members>
5        <members>SalesEvents_chn_ContactChangeEvent</members>
6        <members>SalesEvents_chn_MyCustomObj_ChangeEvent</members>
7        <name>PlatformEventChannelMember</name>
8    </types>
9    <version>64.0</version>
10</Package>

To retrieve a custom channel and channel members, you can reference them in the same package.xml file, as this example shows.

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    <types>
8        <members>SalesEvents_chn_AccountChangeEvent</members>
9        <members>SalesEvents_chn_ContactChangeEvent</members>
10        <members>SalesEvents_chn_MyCustomObj_ChangeEvent</members>
11        <name>PlatformEventChannelMember</name>
12    </types>
13    <version>64.0</version>
14</Package>

Wildcard Support in the Manifest File

This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.