To add event enrichment fields, use the PlatformEventChannelMember Tooling API object,
and specify the fields, the channel, and channel member.
We provide Change Data Capture Enrichment to selected
customers through a pilot program that requires agreement to specific terms and conditions.
To be nominated to participate in the program, contact Salesforce. Pilot programs are
subject to change, and we can’t guarantee acceptance. Change Data Capture Enrichment isn’t
generally available unless or until Salesforce announces its general availability in
documentation or in press releases or public statements. We can’t guarantee general
availability within any particular time frame or at all. Make your purchase decisions only
on the basis of generally available products and features. You can provide feedback and
suggestions for Change Data Capture Enrichment in the Trailblazer Community.
If the channel member you are enriching is part of a custom channel, create the custom
channel first, as shown in this example. You can skip this step if using the ChangeEvents
standard channel, or if you created the custom channel earlier.
Make a POST request to this REST endpoint:
Request body for the custom channel:
To add enrichment fields, perform a REST request that creates a PlatformEventChannelMember
component using Tooling API. In this example, the component contains two enriched fields in
the enrichedFields array for AccountChangeEvent on the
SalesEvents custom channel. External_Account_ID__c is a custom field
defined in your org.
Make a POST request to this REST endpoint (API version 48.0 and later):
Request body with enrichment fields added in a channel member:
You can’t add a duplicate channel member. If the member is already part of the channel,
you can update it to add enriched fields. First, get the channel member ID with this Tooling
API query: SELECT Id,DeveloperName,EventChannel,SelectedEntity
FROM PlatformEventChannelMember. Then make a PATCH request to this URI with the
appended ID: /services/data/v48.0/tooling/sobjects/PlatformEventChannelMember/<ID>.
Alternatively, you can delete the channel member and recreate it with the enriched fields. For
more information, see PlatformEventChannelMember in
the Tooling API Developer Guide.
To find out which channel members and fields you configured, query the EnrichedField object
in Tooling API. For example, this query returns the selected enriched field and the channel
member ID.
In these query results, the first field is the enriched field and the second is the ID of the
channel member. The custom field is returned as an ID.