Newer Version Available

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

Example: Add Event Enrichment Fields with Tooling API

To add event enrichment fields, use the PlatformEventChannelMember Tooling API object.

This example REST request body creates a PlatformEventChannelMember component using Tooling API. The component contains two enriched fields in the enrichedFields array for AccountChangeEvent on the ChangeEvent standard channel.

REST endpoint:

1/services/data/v47.0/tooling/sobjects/PlatformEventChannelMember

Method:

POST

Request body:

1{
2  "FullName": "ChangeEvents_AccountChangeEvent",
3  "Metadata": {
4    "enrichedFields": [
5      {
6        "name": "External_Account_ID__c"
7      },
8      {
9        "name": "Industry"
10      }
11    ],
12    "eventChannel": "ChangeEvents",
13    "selectedEntity": "AccountChangeEvent"
14  }
15}

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.

1Select Field,ChannelMemberId FROM EnrichedField

In these query results, the second field is the ID of a custom field.

1Name,0v8RM00000000JsYAI
200NRM000001gEx32AE,0v8RM00000000JsYAI