← All articles
Salesforce · Change Data Capture · Integration · Quick Reads

Configuring Salesforce CDC enrichedFields with PlatformEventChannelMember

Salesforce CDC enrichment is configured on the channel member, because enrichment applies to a selected change-event entity within a custom channel.

Configuration Shape

Start with a PlatformEventChannel whose ChannelType is data, then create a PlatformEventChannelMember for a CDC entity such as AccountChangeEvent.

Conceptually:

PlatformEventChannel
  FullName: CustomerUpdates__chn
  ChannelType: data

PlatformEventChannelMember
  eventChannel: CustomerUpdates__chn
  selectedEntity: AccountChangeEvent
  enrichedFields:
    - External_Id__c
    - Customer_Number__c

The exact API representation depends on whether you use Metadata API or Tooling API, so use the current Salesforce metadata reference when implementing the request rather than copying a conceptual example blindly.

Salesforce's Limit

Salesforce documents support for up to 10 enriched fields on a CDC channel member.

That limit should influence the design. Rank fields by whether they eliminate a downstream lookup or are necessary to correlate, route, or safely process the event.

Don't Duplicate Filter Fields

If the member also has a filter expression, fields referenced by that expression are automatically included in the delivered CDC event. Salesforce explicitly notes that you do not need to declare those fields again as enriched fields.

A Practical Selection Test

For each candidate enriched field, ask:

  1. Does the subscriber need this value for almost every matching event?
  2. Is the value otherwise absent when unchanged?
  3. Would not having it require another Salesforce API call?
  4. Is it stable enough to be useful as event context?
  5. Is it worth one of the limited enrichment slots?

If the answer is mostly no, leave it out.

Validate the Consumer Too

Configuration is only half the work. With Pub/Sub API, CDC messages use Avro and change-event header bitmap fields need correct decoding. Salesforce documents that unchanged record fields can deserialize with empty values while changedFields identifies actual changes.

Test your consumer with:

  • an update where only a non-enriched field changes;
  • an update where an enriched field changes;
  • a null transition;
  • create and delete scenarios relevant to your flow;
  • replayed events after reconnect.

References

CONTINUE READING

Explore closely related architecture, integration and implementation topics.