Newer Version Available
Data Differences in Event Fields
1"--- \n+++ <hash_value>\n
2 (Changes)"Example
In a Pub/Sub API client, the field contains the unified diff value in this format.
1"<Field_Name>": "--- \n+++ <hash_value>\n
2 (Changes)"
3}And the fields whose values are sent as a unified diff are listed in diffFields in ChangeEventHeader.
In a Streaming API (CometD) client, the field contains the diff subfield, which contains the unified diff value.
1"<Field_Name>": {
2 "diff": "--- \n+++ <hash_value>\n
3 (Changes)"
4}This change event is received in a Pub/Sub API client after the Description field with more than 1,000 characters is updated for an account. The Description field contains the hash value after the +++ prefix followed by the data differences.
1{
2 "ChangeEventHeader": {
3 "entityName": "Account",
4 "recordIds": [
5 "0015f00002JUWMVAA5"
6 ],
7 "changeType": "UPDATE",
8 "changeOrigin": "com/salesforce/api/soap/60.0;client=SfdcInternalAPI/",
9 "transactionKey": "0000654a-b07c-5852-d65f-47dc5ecd631d",
10 "sequenceNumber": 1,
11 "commitTimestamp": 1714149392000,
12 "commitNumber": 1100583868458,
13 "commitUser": "0055f000005mc66AAA",
14 "nulledFields": [],
15 "diffFields": [
16 "0x010000"
17 ],
18 "changedFields": [
19 "0x410000"
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": null,
33 "AnnualRevenue": null,
34 "NumberOfEmployees": null,
35 "Ownership": null,
36 "TickerSymbol": null,
37 "Description": "--- \n+++ 682b8747ccdb93b546e7bbe479b27d26ec7c38ccabb76cdd8308c6595492bffc\n@@ -2,1 +2,1 @@\n-Business applications are moving to the cloud. It’s not just a fad—the shift from traditional software models to the Internet has steadily gained momentum over the last 10 years.\n+Business apps are moving to the cloud. It’s not just a fad—the shift from traditional software models to the Internet has steadily gained momentum over the last 10 years.\n@@ -7,1 +7,1 @@\n-As cloud computing grows in popularity, thousands of companies are simply rebranding their non-cloud products and services as “cloud computing.” Always dig deeper when evaluating cloud offerings.\n+As cloud computing grows in popularity, thousands of companies are simply rebranding their non-cloud products and services as “cloud computing.” Always dig deeper when evaluating cloud offerings. And keep in mind that if you have to buy and manage hardware and software, what you’re looking at isn’t really cloud computing but a false cloud.",
38 "Rating": null,
39 "Site": null,
40 "OwnerId": null,
41 "CreatedDate": null,
42 "CreatedById": null,
43 "LastModifiedDate": 1714149392000,
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}The updates made to the diff field are the following.
- In the paragraph starting with “Business applications,” the word “applications” was replaced with “apps.”
- In the paragraph starting with “As cloud computing grows,”, one sentence was appended at the end of the paragraph: “And keep in mind that if you have to buy and manage hardware and software, what you’re looking at isn’t really cloud computing but a false cloud.”
This event for the account creation shows the original and full values in the Description field before it was updated. If you generate the SHA-256 hash on the full value, you get the same value sent in the account update event (682b8747ccdb93b546e7bbe479b27d26ec7c38ccabb76cdd8308c6595492bffc).
1{
2 "ChangeEventHeader": {
3 "entityName": "Account",
4 "recordIds": [
5 "0015f00002JUWMVAA5"
6 ],
7 "changeType": "CREATE",
8 "changeOrigin": "com/salesforce/api/soap/60.0;client=SfdcInternalAPI/",
9 "transactionKey": "0000653e-941c-2eab-33e9-5459293f4b89",
10 "sequenceNumber": 1,
11 "commitTimestamp": 1714149340000,
12 "commitNumber": 1100583170994,
13 "commitUser": "0055f000005mc66AAA",
14 "nulledFields": [],
15 "diffFields": [],
16 "changedFields": []
17 },
18 "Name": "Acme",
19 "Type": null,
20 "ParentId": null,
21 "BillingAddress": null,
22 "ShippingAddress": null,
23 "Phone": null,
24 "Fax": null,
25 "AccountNumber": null,
26 "Website": null,
27 "Sic": null,
28 "Industry": null,
29 "AnnualRevenue": null,
30 "NumberOfEmployees": null,
31 "Ownership": null,
32 "TickerSymbol": null,
33 "Description": "Everyone is talking about “the cloud.” But what does it mean?\r\nBusiness applications are moving to the cloud. It’s not just a fad—the shift from traditional software models to the Internet has steadily gained momentum over the last 10 years.\r\nCloud computing: a better way\r\nWith cloud computing, you eliminate headaches because you’re not managing hardware and software—that’s the responsibility of an experienced vendor like Salesforce. The shared infrastructure means it works like a utility: you only pay for what you need, upgrades are automatic, and scaling up or down is easy.\r\nCloud-based apps can be up and running in days or weeks, and they cost less. With a cloud app, you just open a browser, log in, customize the app, and start using it.\r\nBusinesses are running all kinds of apps in the cloud, like customer relationship management (CRM), HR, accounting, and much more. Some of the world’s largest companies moved their applications to the cloud with Salesforce after rigorously testing the security and reliability of our infrastructure.\r\nAs cloud computing grows in popularity, thousands of companies are simply rebranding their non-cloud products and services as “cloud computing.” Always dig deeper when evaluating cloud offerings.",
34 "Rating": null,
35 "Site": null,
36 "OwnerId": "0055f000005mc66AAA",
37 "CreatedDate": 1714149340000,
38 "CreatedById": "0055f000005mc66AAA",
39 "LastModifiedDate": 1714149340000,
40 "LastModifiedById": "0055f000005mc66AAA",
41 "Jigsaw": null,
42 "JigsawCompanyId": null,
43 "CleanStatus": "Pending",
44 "AccountSource": null,
45 "DunsNumber": null,
46 "Tradestyle": null,
47 "NaicsCode": null,
48 "NaicsDesc": null,
49 "YearStarted": null,
50 "SicDesc": null,
51 "DandbCompanyId": null,
52 "OperatingHoursId": null,
53 "CustomerPriority__c": null,
54 "SLA__c": null,
55 "Active__c": null,
56 "NumberofLocations__c": null,
57 "UpsellOpportunity__c": null,
58 "SLASerialNumber__c": null,
59 "SLAExpirationDate__c": null
60}