Get Compound Fields in Change Events
Compound fields, such as lead or contact Name, Address, and Geolocation fields, are
represented as nested field structures in the event message. In record updates, the
changedFields header field lists each updated component field using this
format: CompoundField.ComponentField.
The updated component field is included in the event message in a nested field
structure.
Compound Field in a New Record
Example
This example shows a change event received after an account is created with a BillingAddress compound field. The BillingAddress field contains its component fields as nested fields.
1{
2 "ChangeEventHeader": {
3 "entityName": "Account",
4 "recordIds": [
5 "0015f00002JUXA8AAP"
6 ],
7 "changeType": "CREATE",
8 "changeOrigin": "com/salesforce/api/soap/60.0;client=SfdcInternalAPI/",
9 "transactionKey": "00006bec-ce66-0611-9018-30a98446c9f2",
10 "sequenceNumber": 1,
11 "commitTimestamp": 1714156685000,
12 "commitNumber": 1100670838951,
13 "commitUser": "0055f000005mc66AAA",
14 "nulledFields": [],
15 "diffFields": [],
16 "changedFields": []
17 },
18 "Name": "Acme",
19 "Type": null,
20 "ParentId": null,
21 "BillingAddress": {
22 "Street": "415 Mission Street",
23 "City": "San Francisco",
24 "State": "CA",
25 "PostalCode": "94105",
26 "Country": "United States",
27 "Latitude": null,
28 "Longitude": null,
29 "GeocodeAccuracy": null
30 },
31 "ShippingAddress": null,
32 "Phone": null,
33 "Fax": null,
34 "AccountNumber": null,
35 "Website": null,
36 "Sic": null,
37 "Industry": null,
38 "AnnualRevenue": null,
39 "NumberOfEmployees": null,
40 "Ownership": null,
41 "TickerSymbol": null,
42 "Description": null,
43 "Rating": null,
44 "Site": null,
45 "OwnerId": "0055f000005mc66AAA",
46 "CreatedDate": 1714156685000,
47 "CreatedById": "0055f000005mc66AAA",
48 "LastModifiedDate": 1714156685000,
49 "LastModifiedById": "0055f000005mc66AAA",
50 "Jigsaw": null,
51 "JigsawCompanyId": null,
52 "CleanStatus": "Pending",
53 "AccountSource": null,
54 "DunsNumber": null,
55 "Tradestyle": null,
56 "NaicsCode": null,
57 "NaicsDesc": null,
58 "YearStarted": null,
59 "SicDesc": null,
60 "DandbCompanyId": null,
61 "OperatingHoursId": null,
62 "CustomerPriority__c": null,
63 "SLA__c": null,
64 "Active__c": null,
65 "NumberofLocations__c": null,
66 "UpsellOpportunity__c": null,
67 "SLASerialNumber__c": null,
68 "SLAExpirationDate__c": null
69}Compound Field in an Updated Record
Example
This example shows a change event received after updating the Street component field of BillingAddress. The Street field is nested under BillingAddress.
1{
2 "ChangeEventHeader": {
3 "entityName": "Account",
4 "recordIds": [
5 "0015f00002JUXA8AAP"
6 ],
7 "changeType": "UPDATE",
8 "changeOrigin": "com/salesforce/api/soap/60.0;client=SfdcInternalAPI/",
9 "transactionKey": "00006bf0-edfd-6e54-a3f9-e8cefdb2c2b7",
10 "sequenceNumber": 1,
11 "commitTimestamp": 1714156703000,
12 "commitNumber": 1100671026205,
13 "commitUser": "0055f000005mc66AAA",
14 "nulledFields": [],
15 "diffFields": [],
16 "changedFields": [
17 "0x400000",
18 "4-0x01"
19 ]
20 },
21 "Name": null,
22 "Type": null,
23 "ParentId": null,
24 "BillingAddress": {
25 "Street": "415 Mission Street Suite B",
26 "City": null,
27 "State": null,
28 "PostalCode": null,
29 "Country": null,
30 "Latitude": null,
31 "Longitude": null,
32 "GeocodeAccuracy": null
33 },
34 "ShippingAddress": null,
35 "Phone": null,
36 "Fax": null,
37 "AccountNumber": null,
38 "Website": null,
39 "Sic": null,
40 "Industry": null,
41 "AnnualRevenue": null,
42 "NumberOfEmployees": null,
43 "Ownership": null,
44 "TickerSymbol": null,
45 "Description": null,
46 "Rating": null,
47 "Site": null,
48 "OwnerId": null,
49 "CreatedDate": null,
50 "CreatedById": null,
51 "LastModifiedDate": 1714156703000,
52 "LastModifiedById": null,
53 "Jigsaw": null,
54 "JigsawCompanyId": null,
55 "CleanStatus": null,
56 "AccountSource": null,
57 "DunsNumber": null,
58 "Tradestyle": null,
59 "NaicsCode": null,
60 "NaicsDesc": null,
61 "YearStarted": null,
62 "SicDesc": null,
63 "DandbCompanyId": null,
64 "OperatingHoursId": null,
65 "CustomerPriority__c": null,
66 "SLA__c": null,
67 "Active__c": null,
68 "NumberofLocations__c": null,
69 "UpsellOpportunity__c": null,
70 "SLASerialNumber__c": null,
71 "SLAExpirationDate__c": null
72}After decoding the changedFields header field in a Pub/Sub API client, the updated Street field is listed as BillingAddress.Street.
12024-04-26 11:38:24,375 [grpc-default-executor-0] java.lang.Class - ============================
22024-04-26 11:38:24,375 [grpc-default-executor-0] java.lang.Class - Changed Fields
32024-04-26 11:38:24,375 [grpc-default-executor-0] java.lang.Class - ============================
42024-04-26 11:38:24,375 [grpc-default-executor-0] java.lang.Class - LastModifiedDate
52024-04-26 11:38:24,375 [grpc-default-executor-0] java.lang.Class - BillingAddress.Street
62024-04-26 11:38:24,375 [grpc-default-executor-0] java.lang.Class - ============================