Create a Channel Member to Associate a Change Event
To add a change event to the channel that you created, add a channel member. Specify the channel in the eventChannel
field and the event in the selectedEntity
field. This example references a change event, AccountChangeEvent
.
Change events are predefined by Salesforce so you don't need to define them. To learn about Salesforce objects that support change events, see Change Event Object Support in the Change Data Capture Developer Guide.
USER PERMISSIONS NEEDED | |
---|---|
To create a PlatformEventChannelMember: | Customize Application |
To use REST API: | API Enabled |
-
Send a POST request to this URI.
/services/data/v57.0/tooling/sobjects/PlatformEventChannelMember
-
If you’re using Postman, under Tooling, click Post Tooling SObject, and then replace the
:SOBJECT_API_NAME
placeholder withPlatformEventChannelMember
. -
Use this example request body.
-
Send the request. The response received looks similar to this response.
A channel (PlatformEventChannel) can have multiple channel members (PlatformEventChannelMember), which means that you can add multiple change events to a channel. This example adds only one change event, AccountChangeEvent
. To add another event to the channel, create another PlatformEventChannelMember.
See Also
- Tooling API Developer Guide: PlatformEventChannelMember
- Metadata API Developer Guide: PlatformEventChannelMember