Platform Events or Change Data Capture: what's the difference and when do you use each?
Your confidence:Not rated
Model answer
| Platform Events | Change Data Capture |
|---|---|
You define the event and its fields (Order_Ready__e) | Salesforce publishes changes for selected objects |
| Published deliberately (Apex, Flow, API) at a meaningful moment | Every create, update, delete and undelete |
| Carries business meaning | Carries changed fields and header info |
| Good for process hand-offs ("order is ready") | Good for replication and keeping systems in sync |
Both are consumed by Apex triggers, flows (platform events), LWC (empApi) and external subscribers through the Pub/Sub API, with replay IDs for catching up within the retention window. Both are delivered at least once, so consumers must be idempotent.
โ Key points to hit
โ Red-flag answers
- 'CDC is just a platform event with a different name'
- Using CDC to signal business milestones
- Ignoring delivery allocations
โช Follow-ups
Can you add custom fields to a CDC event?
No. CDC events reflect the object's fields and changes. Use enrichment (where available) or a custom platform event if consumers need extra context โ verify current enrichment options.
What's the risk of enabling CDC on a busy object?
High event volume consuming delivery allocations, and consumers receiving many irrelevant changes. Select only the objects needed and filter on the consumer side, or use a custom event.