Salesforce Filtered Channels + Enriched Fields: A Production Integration Pattern
Filtering and enrichment solve different problems, and they are most useful when designed together.
- Filtering decides which events belong in the stream.
- Enrichment supplies selected context needed to process those events.
Example: Customer Master Integration
Assume Salesforce Account changes feed a downstream customer platform.
The downstream system only owns active enterprise customers and identifies them using External_Id__c.
A useful channel design is:
Account changes
|
v
AccountChangeEvent
|
| filter: enterprise/active scope
| enrich: External_Id__c
v
CustomerUpdates__chn
|
v
Pub/Sub subscriber
|
+--> validate/dedupe
+--> transform
+--> downstream customer service
The subscriber no longer needs every Account event, and it doesn't need a Salesforce query merely to obtain the external correlation key.
Avoid Duplicating Filter Fields
Salesforce documents that CDC fields referenced in a filter expression are automatically included in the delivered event. If Customer_Tier__c is part of the filter, don't add it to enrichedFields just to make it available.
Reserve the documented maximum of 10 enriched fields for other essential context.
Consumer Responsibilities
The streamlined payload does not eliminate distributed-systems responsibilities.
The subscriber should still:
- decode Pub/Sub Avro correctly;
- interpret
changedFieldsandnulledFieldsrather than guessing what changed; - persist/process replay position safely;
- make downstream writes idempotent;
- handle retryable and non-retryable failures differently;
- monitor lag, throughput, failures, and reconnects.
Replay and Recovery
Salesforce documents 72-hour retention for platform and CDC events on the event bus. Replay IDs are opaque positions used to retrieve retained events.
Design recovery around that finite window. If an integration can be unavailable longer than the retention period, define a reconciliation/backfill path rather than assuming replay alone is sufficient.
Schema and Contract Governance
Version-control channel/member metadata. Review filter and enrichment changes as integration-contract changes.
A filter modification can add or remove whole classes of events. An enrichment modification changes the context consumers receive. Both deserve testing and release notes.
Observability
At minimum, measure:
- events received;
- events successfully processed;
- duplicates ignored;
- processing latency;
- subscriber reconnects;
- replay/checkpoint position;
- downstream failures;
- reconciliation differences.