Change data capture is a streaming product also called CDC helps you to integrate your Salesforce data with external systems in real time for operation such as creation of a new record, updates to an existing record, deletion of a record, and undeleting of a record. This is very helpful in cases where we need to keep external system in sync with Salesforce in real time instead of doing periodic exports and Imports of data or repeated API calls.
The
SystemModStamp system field.
Any field whose value isn’t on the record and is derived from another record or from a formula, except roll-up summary fields, which are included.
Sample event message in JSON format for a new account record creation:
This example is an event message in JSON format for a new account record creation.
{
"schema":
"IeRuaY6cbI_HsV8Rv1Mc5g",
"payload": {
"ChangeEventHeader": {
"entityName":
"Account",
"recordIds": [
"<record_ID>"
],
"changeType":
"CREATE",
"changeOrigin":
"com/salesforce/api/soap/51.0;client=SfdcInternalAPI/",
"transactionKey":
"0002343d-9d90-e395-ed20-cf416ba652ad",
"sequenceNumber": 1,
"commitTimestamp":
1612912679000,
"commitNumber": 10716283339728,
"commitUser":
"<User_ID>"
},
"Name": "Acme",
"Description": "Everyone is
talking about the cloud. But what does it mean?",
"OwnerId":
"<Owner_ID>",
"CreatedDate":
"2021-02-09T23:17:59Z",
"CreatedById":
"<User_ID>",
"LastModifiedDate":
"2021-02-09T23:17:59Z",
"LastModifiedById":
"<User_ID>"
},
"event": {
"replayId": 6
}
}
How to enable Change Data Capture?
To receive notifications on the default standard channel for record changes, select the custom objects and supported standard objects that you’re interested in on the Change Data Capture page.
From Setup, in
the Quick Find box, enter Change Data Capture, and click Change Data Capture.
The Available Entities list shows the objects available in your Salesforce org
for Change Data Capture, You can select up to five entities, including standard
and custom objects. To enable more entities, contact your Salesforce Account
Representative to purchase an add-on license. The add-on license removes the
limit on the number of entities you can select. Also, it increases the event
delivery allocation for CometD and Pub/Sub API clients. With the add-on
license, you can select up to 10 entities at a time in the Available Entities
list. After selecting the first 10 entities, you can add more.
Note: You can also 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.
Subscribe to Change Events:
As we have setup CDC for Account above. Let us try to update an account record and click Save.
Now, go back to workbench. You will be able to see the notification as shown below.
No comments:
Post a Comment