when yo use change data capture and platform events in salesfroce ?
Change Data Capture vs Platform Events Both are part of Salesforce's event-driven architecture. They use a publish/subscribe model on the Event Bus, so publishers and subscribers are decoupled. Change Data Capture (CDC) Use it when you need to react to changes in Salesforce records. Salesforce publishes the event automatically when a record is created, updated, deleted, or undeleted. You don't write any publishing code. The event carries the changed fields, plus header details like the change type and the user who made the change. You enable it per object (Setup > Change Data Capture), and the channel name looks like /data/AccountChangeEvent . Typical use cases: Syncing Salesforce data to an external system such as an ERP, data warehouse, or SAP, in near real time. Keeping a replica or cache up to date without polling. Audit or history tracking outside Salesforce. Triggering Apex when specific fields on a record change. Platform Events Use them when you ne...