Introduction
As businesses strive to become more connected and responsive, real-time data integration has shifted from being a luxury to a necessity. In the Salesforce ecosystem, Change Data Capture (CDC) is a powerful feature that enables this transformation by allowing platforms to react instantly to data changes.
Whether you're syncing Salesforce with external systems, triggering workflows, or simply monitoring data changes, CDC provides a scalable and event-driven solution.
What is Change Data Capture (CDC)?
Change Data Capture in Salesforce is a mechanism that publishes changes to Salesforce records as events in real time. These events are delivered using the Platform Events framework, which allows other systems to subscribe and respond instantly.
Whenever a record is created, updated, deleted, or undeleted, a Change Event is published with all relevant information.
How Does CDC Work?
- Enable CDC on Objects
You choose which standard or custom objects should publish change events by enabling CDC for those objects. - Salesforce Listens for Changes
Once enabled, Salesforce automatically tracks changes to records for the selected objects. -
Change Events are Published
Each change triggers a Change Event, which includes:
- Record ID
- Changed fields
- Old and new values (optional)
- Change type (CREATE, UPDATE, DELETE, UNDELETE)
- Transactional metadata (user ID, transaction ID, etc.)
-
External or Internal Subscribers React
Subscribers (external systems, middleware, or Apex triggers) can consume these events via:
- CometD (Streaming API)
- EMP Connector
- Apex Triggers (for internal logic)
Anatomy of a Change Event
Here’s a simplified view of a change event payload:
{
"entityName": "Account",
"changeType": "UPDATE",
"recordIds": ["0017F00000XXXX"],
"changeReplayId": 10005,
"changedFields": ["Name", "Industry"],
"data": {
"Name": "Acme Corp",
"Industry": "Technology"
}
}
Key Features of CDC
Problem:
Enable CDC only on the objects that matter for your integration use case.
Bulk Events
Change events can batch multiple record changes into a single notification for efficiency.
Replay IDs
Events are retained for 72 hours and can be replayed using Replay IDs — ideal for fault-tolerant subscribers.
Transactional Metadata
Includes useful audit info like the user who made the change and when.
Permission-Aware
Respects field-level security and sharing settings when publishing field values.
CDC vs. Traditional Integration Methods
Common Use Cases
Data Sync to External Systems
Sync Salesforce data with external databases, ERPs, or analytics platforms in near-real-time.
Triggering External Workflows
Automatically notify external systems (e.g., send emails, update dashboards) when key Salesforce data changes.
Real-Time BI/Analytics
Stream CRM changes to data lakes or BI tools like Snowflake or Tableau for up-to-date reporting.
Audit & Monitoring
Track changes to sensitive objects (like Opportunities or Cases) for compliance and auditing purposes.
Object Support
Change Data Capture can generate change events for all custom objects defined in your Salesforce org and a subset of standard objects. It supports change events for the most popular standard objects:- For a list of objects that support change events, see StandardObjectNameChangeEvent in the Object Reference for Salesforce and Lightning Platform.
Setting Up CDC (Step-by-Step)
-
Enable CDC for an Object
Go to Setup > Change Data Capture → Select the objects you want to track.
-
Subscribe to Events
- Use Connector, CometD, or Apex Triggers.
- External apps can subscribe via Streaming API.
-
Handle Events
-
Process data changes and update your external systems or trigger workflows.
-
Process data changes and update your external systems or trigger workflows.
Best Practices
- Use Field Filtering
Avoid unnecessary noise by enabling CDC only for important objects and monitoring critical fields. - Implement Replay Logic
Handle missed events with Replay IDs in case your subscriber goes down temporarily. - Secure Your Integration
Always enforce authentication and respect user permissions in your event handling logic. - Monitor Event Usage
Watch event delivery metrics and Streaming API usage to stay within Salesforce limits. - Set Up Alerts
Use alerts to notify your team if the system that reads events stops working. That way, you can fix it before 72 hours pass.
What’s a Replay ID?
Every change event has a unique number called a Replay ID. This helps your system remember which events it has already processed. If your system goes offline for a bit, it can come back and ask Salesforce for "events starting from this Replay ID" so it doesn’t miss anything.
How Long Are CDC Events Stored?
When Salesforce sends out change events, it keeps them for 72 hours (that’s 3 days). After that, the events are deleted and can’t be retrieved, not even by Salesforce. So, if your system that listens to these events goes down for more than 3 days, it will miss those changes forever.
Integrating with MuleSoft or External Systems
Salesforce CDC fits beautifully with integration platforms like MuleSoft, allowing you to:
- Instantly move Salesforce data to external apps
- Trigger business logic in real-time
- Eliminate the need for polling or scheduled syncs
Conclusion
Salesforce Change Data Capture transforms your CRM into a real-time event hub, giving you instant visibility into data changes and enabling powerful, reactive integrations.
If you're building a connected architecture where data agility matters, CDC is not just useful — it's essential.
Got questions? Feel free to drop an email to support@astreait.com