Change Data Capture Developer Guide
Summer '26 (API version 67.0)
Spring '26 (API version 66.0)
Winter '26 (API version 65.0)
Summer '25 (API version 64.0)
Spring '25 (API version 63.0)
Winter '25 (API version 62.0)
Summer '24 (API version 61.0)
Spring '24 (API version 60.0)
Winter '24 (API version 59.0)
Summer '23 (API version 58.0)
Spring '23 (API version 57.0)
Winter '23 (API version 56.0)
Summer '22 (API version 55.0)
Spring '22 (API version 54.0)
Winter '22 (API version 53.0)
Summer '21 (API version 52.0)
Spring '21 (API version 51.0)
Winter '21 (API version 50.0)
Summer '20 (API version 49.0)
Spring '20 (API version 48.0)
Winter '20 (API version 47.0)
Summer '19 (API version 46.0)
Spring '19 (API version 45.0)
Winter '19 (API version 44.0)
Merged Change Events
Change Event Storage and Delivery
Subscription Channels
Compose Streams of Change Data Capture Notifications with Custom Channels
Example Diagrams for Channels and Channel Members
High-Level Replication Steps
Subscribe with CometD Using the EMP Connector Sample
Monitor Change Event Publishing and Delivery Usage
Newer Version Available
Subscribe to Change Events
You subscribe to change events with CometD or Apex triggers. CometD is a messaging
library that enables listening to events through long polling and simulates push technology.
Apex triggers for change events are similar to Apex triggers on platform events.
-
Change Event Storage and Delivery
Change events are stored temporarily and subscribers can retrieve them during the retention window. The order of events delivered is based on the order of the corresponding committed transactions. Users with the proper permissions can receive events on a channel. -
Subscription Channels
A subscription channel is a stream of change events that correspond to one or more entities. You can subscribe to a channel to receive change event notifications for record create, update, delete, and undelete operations. Change Data Capture provides predefined standard channels and you can create your own custom channels. Use the subscription channel that corresponds to the change events you want to receive. The channel name is case-sensitive. -
Compose Streams of Change Data Capture Notifications with Custom Channels
Create a custom channel if you have multiple subscribers and each subscriber receives change events from a different set of entities. Also, use a custom channel with event enrichment to isolate sending enriched fields in change events on a specific channel. Custom channels group and isolate change events for each subscriber so subscribers receive only the types of events they need. -
Example Diagrams for Channels and Channel Members
Discover the relationship between channels, channel members, and enriched fields with the Entity Relationship Diagram (ERD). Also, understand the benefits of using custom channels through the example diagrams. -
High-Level Replication Steps
To maintain an accurate replica of your Salesforce org’s data in another system, subscribe using a transaction-based approach. -
Subscribe with CometD Using the EMP Connector Sample
Salesforce provides a connector to CometD that subscribes to streaming events. The EMP connector sample is a thin wrapper around the CometD library and simplifies subscribing to data change events in Java. The tool subscribes to a channel, receives notifications, and supports replaying events with durable streaming. -
Enrich Change Events with Extra Fields When Subscribed with CometD
Change event messages include values for new and changed fields, but sometimes unchanged field values are needed for processing or replicating data. For example, use enrichment when your app needs an external ID field for matching records in an external system. Or always include a field that provides important information about the changed record. You can select any field whose type is supported. -
Subscribe with Apex Triggers
With Apex triggers, you can capture and process change events on the Lightning Platform. Change event triggers run asynchronously after the database transaction is completed. Perform resource-intensive business logic asynchronously in the change event trigger, and implement transaction-based logic in the Apex object trigger. By decoupling the processing of changes, change event triggers can help reduce transaction processing time.