Newer Version Available
Enrich Change Events with Extra Fields When Subscribed with CometD (Beta)
Event enrichment is supported for subscribers that use CometD, such as Streaming API clients or EMP Connector. 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. If the enriched fields have an empty value, they're not included in the event messages. 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 is not 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, the following field types are supported for enriched fields.
- Auto Number
- Checkbox
- Date, Date/Time, Time
- External Lookup Relationship
- Hierarchical Relationship on User
- Lookup Relationship
- Number
- Percent
- Phone (and Fax)
- Picklist (not Multi-Select)
- Text
- URL
Select fields to enrich your change event messages using the PlatformEventChannelMember object in Tooling API or Metadata API. You can select up to 10 fields for a channel member across all channels. Only unique fields are counted across all channels for the same member, so the same field is counted only once. For example, AccountChangeEvent is a member of two channels. It contains five enriched fields on the ChangeEvents channel and four fields on a custom channel, two of which are also on the ChangeEvents channel. The total number of enriched fields that count toward the maximum is seven.