Keep Your External Data up to Date with Change Data Capture (Pilot)

Receive near-real-time changes of Salesforce records, and synchronize corresponding records in an external data store. Change Data Capture publishes data change events, which represent changes to Salesforce records. Changes include creation of a new record, updates to an existing record, deletion of a record, and undeletion of a record.
Note

Note

We provide Change Data Capture to selected customers through a pilot program that requires agreement to specific terms and conditions. To be nominated to participate in the program, contact Salesforce. Pilot programs are subject to change, and we can’t guarantee acceptance. Change Data Capture isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide feedback and suggestions for Change Data Capture in this Trailblazer Community group.

Available in: Performance, Unlimited, Enterprise, and Developer Editions

For example, you have a human resource (HR) system with copies of employee custom object records from Salesforce. You can synchronize the employee records in the HR system by receiving data change events from Salesforce. After receiving the events, you can process the corresponding insert, update, delete, or undelete operations in the HR system. Because the changes are received in near real time, the data in your HR system stays up to date.

Data change events are available for all custom objects defined in your Salesforce org. Events for a custom object aren’t published until you enable them for that object. Data change events are available and automatically enabled for a subset of standard objects. Data change events are published on a channel (the event bus) when changes occur in Salesforce.

Example

This data change event is sent when an account is created.

{
  "data": {
    "schema": "IeRuaY6cbI_HsV8Rv1Mc5g", 
    "payload": {
      "ChangeEventHeader": {
        "entityName": "Account", 
        "recordIds": [
          "001R0000002aV0B"
        ], 
        "changeType": "CREATE", 
        "changeOrigin": "com.salesforce.core", 
        "transactionKey": "001b7375-0086-250e-e6ca-b99bc3a8b69f", 
        "sequenceNumber": 1, 
        "isTransactionEnd": true, 
        "commitTimestamp": 1501010206653, 
        "commitNumber": 92847272780, 
        "commitUser": "<User_ID>"
      }, 
      "Name": "Acme", 
      "Description": "Everyone is talking about the cloud. But what does it mean?", 
      "OwnerId": "<Owner_ID>", 
      "CreatedDate": "2017-11-30T19:16:44Z", 
      "CreatedById": "<User_ID>", 
      "LastModifiedDate": "2017-11-30T19:16:44Z", 
      "LastModifiedById": "<User_ID>"
    }, 
    "event": {
      "replayId": 6
    }
  }, 
  "channel": "/data/ChangeEvents"
}

The Data Change Capture pilot was introduced in the last release. In this release, we made these enhancements.

Support for New Standard Objects

In addition to standard objects previously supported, Data Change Capture now supports these standard objects.

  • Event
  • EventRelation
  • Task
  • TaskRelation
  • Person Account

You can receive data change events for single and recurring tasks and calendar events, including events with invitees. Each activity occurrence and event invitee are tracked by individual data change events. If Shared Activities is enabled, the relationships between a task and its parent records (for example, contacts or lead), which correspond to TaskRelation objects, are tracked through change events. Similarly, the relationships between a calendar event and its parent records, which correspond to EventRelation objects, are also tracked. If Shared Activities isn't enabled, EventRelation objects represent relationships to invitees and are tracked by change events.

If Person Accounts is enabled, data change events are generated for any change in a person account. Because a person account record combines fields from an account and a contact, a change in a person account results in two data change events: one change event for the account record and another for the contact record.

Gap Events

Note

Note

Gap Events are enabled separately from the Change Data Capture (Pilot) feature. To enable Gap Events, contact Salesforce.

Change Data Capture tracks record operations that are part of transactions in Salesforce application servers by generating data change events. However, some operations are applied directly in the database outside of a transaction in the Salesforce application servers. For example, archiving activities or a data cleanup job in the database. To not miss these operations, gap events are generated to capture the changes.

A gap event contains information about the change in the header, such as the change type (with a prefix of GAP_) and record ID. But a gap event doesn’t contain details about the change, such as record fields. When your app receives a gap event message, it can retrieve the Salesforce record. The app uses the record ID value to get the current data for your system.

Overflow Events

To capture changes more efficiently, overflow events are generated for single transactions that contain many changes. Overflow events are generated when a single transaction contains more than 100,000 changes for the records that are above the 100,000-change threshold. An overflow event contains less information about a change than a data change event. An overflow event has a changeType field header value of GAP_OVERFLOW instead of the specific type of change. It also contains the object type in the entityName field. An overflow event doesn’t include details about the change, such as record fields or the record ID.

Transactions with a high volume of operations are not frequent, but they can occur in some situations. For example, the creation of a recurring event with hundreds of occurrences and hundreds of attendees. Or a cascade delete of accounts that are associated with many opportunities, contacts, and activities, which results in deleting many more records in the same transaction.