Change Data Capture in Salesforce Featured Image

Most Salesforce tutorials introduce Change Data Capture in Salesforce as just another integration tool — explain the acronym, show a trigger snippet, and call it a day. But if you’ve been around real enterprise projects, you know CDC is quietly one of the most powerful, underutilized features on the Lightning Platform. When used well, it can eliminate entire layers of custom integration code and make your architecture dramatically more resilient.

This post goes beyond the basics. You’ll understand not just what CDC is, but why it was designed the way it is, when to reach for it versus other streaming options, and how understanding it deeply can separate you from other Salesforce candidates in the job market.

At its core, Change Data Capture is Salesforce’s built-in mechanism for broadcasting record-level changes — creates, updates, deletes, and undeletes — as real-time event messages over a streaming channel. Any subscriber (an external app, an Apex trigger, an LWC) can listen to that channel and react to changes without polling the database or building a custom notification pipeline.

Think of it like this: instead of checking your mailbox every hour to see if a letter arrived, CDC installs a doorbell. The moment something changes, you’re notified — with the exact details of what changed.

But here’s what most tutorials don’t emphasize: CDC was designed specifically to solve the data synchronization problem at scale. That’s a fundamentally different design goal than Platform Events (which are for custom business signals) or Streaming API PushTopics (which are for SOQL-filtered queries). Understanding this distinction is the real unlock.

How Change Data Capture Actually Works Under the Hood

When a Salesforce record is modified, CDC publishes a change event message to a dedicated channel (e.g., /data/AccountChangeEvent). This message contains:

  • Header fields — metadata about the change: what type of operation occurred, the transaction key, the originating client ID, and whether this is the end of a transaction.
  • Body fields — only the fields that actually changed, not the entire record. This “delta” approach is efficient and intentional.

Two things here that most beginner content glosses over:

1. The transaction boundary feature is a big deal. CDC groups related changes using a transactionKey. If a single Apex transaction updates 50 Opportunity records, all 50 change events share the same key. An external integration system can use this to apply changes atomically — commit all or nothing — which is exactly the behaviour needed for financial or inventory systems.

2. CDC ignores sharing rules but respects field-level security. Your external system receives change events for all records, regardless of who owns them or what sharing rules apply. But if a field is restricted by FLS, it won’t appear in the payload. This is a critical architectural nuance when designing integrations that involve sensitive data.

CDC vs. Platform Events vs. PushTopics: Choosing the Right Tool

This is where a lot of developers go wrong — they reach for CDC when they should use Platform Events, or vice versa.

Scenario Best Tool
Sync Salesforce records to an external DB in real time Change Data Capture
Trigger a custom business process across systems Platform Events
Listen for specific record changes via a SOQL filter PushTopics (legacy)
React to record changes within Salesforce asynchronously Async Apex Trigger (CDC)

The mental model: CDC is outbound data replication. Platform Events are custom business signals.

If a client’s ERP needs to know every time an Account is updated, that’s CDC. If your order management flow needs to trigger a fulfillment step when an Opportunity is Closed Won, that’s a Platform Event — because you control the signal, the payload, and the business meaning.

Asynchronous Apex Triggers: The Hidden Superpower of CDC

This is where CDC gets genuinely exciting for Salesforce Developers.

When you enable an object for Change Data Capture and write an Apex trigger on its change event object (e.g., AccountChangeEvent), that trigger runs asynchronously — after the database transaction is committed. This is fundamentally different from a standard DML-based trigger.

Why does this matter in practice?

Standard Apex triggers run inside a transaction. Every callout, every heavy computation, eats into your governor limits before the record is saved. One expensive trigger can make your UI feel sluggish.

With an async CDC trigger, you can offload the heavy work — sending emails, making callouts to external APIs, calculating complex rollups — to a process that runs in the background, under the Automated Process entity, with its own governor limit context. The user’s save action is fast. The side effects happen asynchronously.

Think of it as the difference between a restaurant that makes you wait at the counter while your food is being cooked versus one that takes your order, seats you, and brings the food when it’s ready.

Practical example: An e-commerce company uses Salesforce to manage product inventory. Every time a product’s Stock_Level__c field drops below a threshold, they want to trigger a reorder request to their ERP. Instead of making a synchronous callout inside a trigger (which risks hitting limits and degrading save performance), they subscribe to the Product2ChangeEvent channel with an async trigger that fires after the update is committed. Clean, scalable, and limit-friendly.

Real-World Use Cases: Where CDC Actually Gets Deployed

Change Data Capture Salesforce

1. Data Warehouse Synchronization

Companies running analytics on AWS Redshift, Snowflake, or BigQuery can’t afford stale Salesforce data. CDC provides a near-real-time feed of every record change without requiring scheduled batch jobs or API polling. A middleware layer (MuleSoft, Heroku, or custom AWS Lambda) subscribes to the CDC channel and writes deltas to the warehouse. This reduces load on both systems and gives analytics teams fresher data.

2. Cross-System Record Mirroring

When Salesforce is one CRM among several — common in post-merger enterprise environments — CDC can keep records in sync across platforms. A change to a Contact in Salesforce can automatically propagate to a legacy system like SAP or Oracle without the need for a full nightly sync job that risks data conflicts.

3. Audit Trails and Compliance Logging

Regulated industries (finance, healthcare) require detailed audit logs of who changed what and when. CDC’s event payload includes not just what changed but metadata about the change origin. External logging systems can consume these events to maintain tamper-proof, time-stamped records that are independent of Salesforce’s own audit trail limits.

4. Mobile App Offline Sync

With CDC’s event retention (up to 72 hours by default), mobile apps can catch up on missed changes after coming back online. This replay capability — where a subscriber can request events from a specific point in time — is something many developers don’t know exists until they need it.

How to Enable and Implement CDC: A Practical Walkthrough

Step 1: Enable the Object for CDC

Navigate to Setup → Integrations → Change Data Capture. Move the objects you want to monitor from Available Entities to Selected Entities. Standard objects like Account, Contact, Lead, Opportunity, and Case are supported, as are all custom objects.

Step 2: Write an Asynchronous Apex Trigger

In Developer Console or VS Code, create a trigger on the change event object:

trigger AccountChangeTrigger on AccountChangeEvent (after insert) {
    List<String> recordIds = new List<String>();
    
    for (AccountChangeEvent event : Trigger.New) {
        EventBus.ChangeEventHeader header = event.ChangeEventHeader;
        recordIds.addAll(header.recordIds);
        
        // Only process update operations
        if (header.changeType == 'UPDATE') {
            // Add your business logic here
        }
    }
}

Step 3: Use the Header Fields Intelligently

Don’t just react to every event blindly. Use changeType to filter for specific operations. Use changedFields to check which fields actually changed before running expensive logic. Use transactionKey and isTransactionEnd when integrating with systems that require atomic commits.

Step 4: Handle Replay and Retries

If your subscriber goes offline, use the replay ID mechanism to request events from up to 72 hours back. This built-in durability is what makes CDC suitable for mission-critical integrations.

Common Mistakes Salesforce Developers Make with CDC

Mistake 1: Using CDC when you need Platform Events. CDC is for reacting to record changes. If you need to broadcast a custom business event (like “order approved” or “SLA breached”), Platform Events are the right choice. They give you full control over the payload and the triggering logic.

Mistake 2: Writing heavy logic in a synchronous trigger instead of an async CDC trigger. If your trigger needs to make external callouts or process large data volumes, move that logic to an async CDC trigger. It’s what the feature was designed for.

Mistake 3: Ignoring the changedFields metadata. Every CDC event tells you exactly which fields changed. Reacting to an Account update without checking changedFields means your integration fires even when an irrelevant field like LastModifiedDate is touched. Always filter on changed fields first.

Mistake 4: Assuming CDC works for all objects out of the box. CDC supports most standard objects, but not all. Always verify object support in the official documentation before designing an integration around it.

Mistake 5: Forgetting about the 72-hour retention window. CDC events are retained for 72 hours. If your subscriber is down for longer than that, you’ll miss events and have no way to replay them. Design a fallback — usually a scheduled batch job that reconciles data gaps — for this scenario.

Why CDC Matters for Your Salesforce Career in 2026 and Beyond

Salesforce is moving aggressively toward event-driven architecture. Data Cloud, Agentforce, and the Einstein AI layer all depend on real-time data flows to function. CDC is one of the foundational pieces of that stack.

For job seekers, here’s the honest picture: most entry-level Salesforce roles don’t explicitly ask about CDC in interviews. But when you bring it up unprompted — explaining how you’d use async CDC triggers to offload callouts, or how CDC feeds a data warehouse — you immediately signal that you think architecturally, not just tactically. That’s what mid-senior hiring managers are looking for.

For developers building toward the Platform Developer I certification, CDC intersects with several exam topics: asynchronous Apex, governor limits, and event-driven architecture. Understanding it deeply pays dividends across multiple sections of the exam, not just the integration questions.

The broader trend: as enterprises push more workloads into Salesforce and connect it to AI systems, the ability to design clean, scalable, event-driven integrations becomes a genuine differentiator. CDC is a skill that compounds.

Final Thoughts: CDC Is an Architectural Mindset, Not Just a Feature

The Salesforce professionals who grow fastest aren’t the ones who memorize every feature — they’re the ones who understand why features were designed the way they were. Change Data Capture was built to solve a hard problem: keeping systems in sync, at scale, without polling, without data loss, and without expensive custom pipelines.

When you understand that design intent, you start to see CDC everywhere it should be used — and you build integrations that are cleaner, faster, and more maintainable than the alternative.

Start with the async trigger. Experiment with the event payload. Try subscribing from an external system. The moment it clicks, you’ll wonder how you ever approached real-time sync without it.

Ready to Build Real-World Salesforce Skills?

If this post got you thinking about how Salesforce development really works in practice — not just theory — the next step is hands-on experience with real projects.

The Salesforce Certified Platform Developer I course on MyTutorialRack is built around that exact philosophy. You’ll work through real implementation scenarios covering Apex, LWC, Aura, and integration patterns — the kind of hands-on, job-ready learning that makes a difference when you’re sitting across from an interviewer. It’s structured for developers who want to understand the why behind every concept, not just pass a multiple-choice exam.

If you’re serious about landing a Salesforce Developer role, it’s worth a look.

Share:

Recent Posts