Skip to main content

SF-9107 · Concept · Medium

What is Change Data Capture?

✓ Verified by Vikas Singhal · Last reviewed 5/17/2026 · Updated for Spring '26

Change Data Capture (CDC) is a built-in Salesforce feature that emits a streaming event every time a record is created, updated, deleted, or undeleted on the objects you enable. External systems subscribe to the event channel and stay in sync with Salesforce without polling and without anyone writing a trigger.

Why it exists

The traditional way to sync Salesforce data to an external warehouse:

  1. Cron job runs every 15 minutes
  2. Queries Account WHERE LastModifiedDate > :lastRun
  3. Hopes nothing was deleted (deletes don’t show up in SOQL of the live table)
  4. Pulls full record bodies, even if only one field changed
  5. Burns API limits on every poll

CDC fixes all of that. The platform emits an event the moment a record changes. The event carries only the changed fields, plus the record Id, change type, and a header with replay metadata. Subscribers get notified in seconds.

What an event looks like

{
  "schema": "8FH...",
  "payload": {
    "ChangeEventHeader": {
      "entityName": "Account",
      "recordIds": ["001xx000003GeQqAAK"],
      "changeType": "UPDATE",
      "changeOrigin": "user/005xx000001SwiqAAC",
      "transactionKey": "0009b3...",
      "sequenceNumber": 1,
      "commitTimestamp": 1747497600000,
      "changedFields": ["Industry", "AnnualRevenue", "LastModifiedDate"]
    },
    "Industry": "Manufacturing",
    "AnnualRevenue": 5000000
  }
}

Notice: only the changed fields appear in the payload alongside the header. The subscriber doesn’t get a full record copy, just the delta.

How to enable it

Setup > Change Data Capture > Select Entities. Pick the objects you want streamed. Up to 5 custom + many standard objects on the free allocation; more requires CDC for All Objects licence.

Subscribers connect via:

  • Pub/Sub API (gRPC) — modern, recommended for any new build
  • CometD streaming API — legacy, still supported
  • Apex Trigger on the event channel — handle CDC inside Salesforce itself

Apex subscriber example

trigger AccountChangeTrigger on AccountChangeEvent (after insert) {
    for (AccountChangeEvent evt : Trigger.new) {
        EventBus.ChangeEventHeader header = evt.ChangeEventHeader;
        if (header.changeType == 'UPDATE'
            && header.changedFields.contains('Industry')) {
            // Re-rate territory, sync to data lake, etc.
        }
    }
}

CDC vs Platform Events vs PushTopic

FeatureCDCPlatform EventPushTopic
SchemaDefined by the objectYou defineSOQL query you write
TriggerAny DML on enabled objectExplicit EventBus.publish()Any DML matching the query
Use caseData replication, syncCustom business eventsLegacy, mostly deprecated for new builds
PayloadOnly changed fieldsWhatever you put inFull record snapshot

Limits

  • 5 custom objects on standard allocation (more with add-on)
  • 24-hour retention, 72-hour with High-Volume retention add-on
  • 250,000 events per day shared with Platform Events
  • Replay by ReplayId for catching up after subscriber downtime

Common interview follow-ups

  • Use CDC or Platform Events for an order placed notification? — Platform Events. CDC is for syncing data state; Platform Events are for business signals.
  • Does CDC fire on bulk updates? — Yes, but events are grouped by transaction; you might receive one event per record or one event listing many recordIds (same transactionKey).
  • What about field-level security? — CDC ignores FLS — subscribers see all fields, so secure the subscriber side.

Verified against: Change Data Capture Developer Guide. Last reviewed 2026-05-17 for Spring ‘26 release.