Enrich Change Events with Extra Fields
Event enrichment is supported for subscribers that use Pub/Sub API, CometD (Streaming API), or event relays. Fields that you select for enrichment are included in change events for update and delete operations. Enriched fields aren’t included in change events for create and undelete operations because these events contain all the populated fields. Also, because no change event is generated for a hard-deleted record, which is a record deleted from the Recycle Bin, enriched fields aren’t available. If the enriched fields have an empty value, they aren’t included in the event messages in CometD clients and event relays, and are included with null values in Pub/Sub API clients. If the enriched fields are updated to null, they’re included in the event as changed fields and not as enriched fields.
Event enrichment is available for channels that support multiple entities, such as the standard /data/ChangeEvents channel, or custom channels, such as /data/SalesEvents__chn. You can’t add enrichment directly to single-entity channels, such as /data/<Entity>ChangeEvent. For example, say that you want to add the Account Industry field for enrichment. You can do that to the custom channel SalesEvents__chn, assuming AccountChangeEvent is a member of that channel. Then, if you subscribe to /data/SalesEvents__chn, the Industry field is included in account change events on that channel. If you subscribe to another channel that isn’t enriched with this field, such as /data/ChangeEvents, or another custom channel, account change events don’t include the Industry field.
We recommend that you configure event enrichment on a custom channel and not the standard /data/ChangeEvents channel. This way, other subscribers that receive change events on the standard channel don’t receive unchanged fields that they don’t expect. If you create a custom channel and configure event enrichment on it, you isolate the fields sent to only the clients that anticipate those fields. To learn how to create a custom channel, see Compose Streams of Change Data Capture Notifications with Custom Channels.
As part of the fields that a change event object contains, these field types are supported for enriched fields.
- Address
- Auto Number
- Checkbox
- Currency
- Date, Date/Time, Time
- External Lookup Relationship
- Geolocation
- Hierarchical Relationship on User
- Lookup Relationship
- Master-Detail Relationship
- Name
- Number
- Percent
- Phone (and Fax)
- Picklist
- Roll-Up Summary
- Text
- TextArea
- URL
Select fields to enrich your change event messages by using the PlatformEventChannelMember object in Tooling API or Metadata API.