To add a change event to the channel that you created, add a channel member.
Required Editions
| User Permissions Needed | |
|---|---|
| To create a PlatformEventChannel: | Customize Application |
Prerequisites:
Change events are predefined by Salesforce so you don’t define them. To learn about Salesforce objects that support change events, see Change Event Object Support in the Change Data Capture Developer Guide.
-
Send a POST request to this URI.
/services/data/v65.0/tooling/sobjects/PlatformEventChannelMember - If you’re using Postman, expand Event Platform | Custom Channels | Platform Event, and click Create channel member.
-
Specify the channel in the
eventChannelfield and the event in theselectedEntityfield. This example references a change event,AccountChangeEvent. Use this example request body. In Postman, click Body, and replace the body with this JSON body.{ "FullName": "Account_Channel_chn_AccountChangeEvent", "Metadata": { "eventChannel": "Account_Channel__chn", "selectedEntity": "AccountChangeEvent" } } -
Send the request. The response received looks similar to this response.
{ "id": "0v8RM0000000GHCYA2", "success": true, "errors": [], "warnings": [], "infos": [] }
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.