Merged Change Events
For efficiency, sometimes change events for one transaction are merged into one event if
the same change occurred in multiple records of the same object type during one second.
When change events are merged, Salesforce sends one change event for all affected records and the recordIds field contains the IDs for all records that have the same change.
Examples of operations with same changes are:
- Update of fieldA to valueA in Account records.
- Deletion of Account records.
- Renaming or replacing a picklist value that results in updating the field value in all affected records.
For more information about the recordIds field, see ChangeEventHeader Fields.
Example
If you update the Industry field to Apparel of three Account records in a single update Apex DML statement, one merged
change event is sent as shown in this example. The recordIds field
contains the IDs of the Account records that have the same
change.
1{
2 "ChangeEventHeader": {
3 "entityName": "Account",
4 "recordIds": [
5 "0015f00002JUZPDAA5",
6 "0015f00002JUZPXAA5",
7 "0015f00002JUZPcAAP"
8 ],
9 "changeType": "UPDATE",
10 "changeOrigin": "com/salesforce/api/soap/60.0;client=devconsole",
11 "transactionKey": "00065380-d1a9-a64a-9341-14f6f12f674c",
12 "sequenceNumber": 1,
13 "commitTimestamp": 1714170102000,
14 "commitNumber": 1100823480049,
15 "commitUser": "0055f000005mc66AAA",
16 "nulledFields": [],
17 "diffFields": [],
18 "changedFields": [
19 "0x400800"
20 ]
21 },
22 "Name": null,
23 "Type": null,
24 "ParentId": null,
25 "BillingAddress": null,
26 "ShippingAddress": null,
27 "Phone": null,
28 "Fax": null,
29 "AccountNumber": null,
30 "Website": null,
31 "Sic": null,
32 "Industry": "Apparel",
33 "AnnualRevenue": null,
34 "NumberOfEmployees": null,
35 "Ownership": null,
36 "TickerSymbol": null,
37 "Description": null,
38 "Rating": null,
39 "Site": null,
40 "OwnerId": null,
41 "CreatedDate": null,
42 "CreatedById": null,
43 "LastModifiedDate": 1714170102000,
44 "LastModifiedById": null,
45 "Jigsaw": null,
46 "JigsawCompanyId": null,
47 "CleanStatus": null,
48 "AccountSource": null,
49 "DunsNumber": null,
50 "Tradestyle": null,
51 "NaicsCode": null,
52 "NaicsDesc": null,
53 "YearStarted": null,
54 "SicDesc": null,
55 "DandbCompanyId": null,
56 "OperatingHoursId": null,
57 "CustomerPriority__c": null,
58 "SLA__c": null,
59 "Active__c": null,
60 "NumberofLocations__c": null,
61 "UpsellOpportunity__c": null,
62 "SLASerialNumber__c": null,
63 "SLAExpirationDate__c": null
64}After being decoded in a Pub/Sub API client, the changedFields field lists the Industry field as one of the changed fields.
12024-04-26 15:21:43,674 [grpc-default-executor-0] java.lang.Class - ============================
22024-04-26 15:21:43,674 [grpc-default-executor-0] java.lang.Class - Changed Fields
32024-04-26 15:21:43,674 [grpc-default-executor-0] java.lang.Class - ============================
42024-04-26 15:21:43,674 [grpc-default-executor-0] java.lang.Class - Industry
52024-04-26 15:21:43,674 [grpc-default-executor-0] java.lang.Class - LastModifiedDate
62024-04-26 15:21:43,674 [grpc-default-executor-0] java.lang.Class - ============================