Newer Version Available

This content describes an older version of this product. View Latest

Change Event Body Fields

The body of a change event message includes the fields and values for the corresponding Salesforce record.

JSON Change Event Messages

The fields that Salesforce includes in a JSON event message that a CometD client receives depend on the operation performed.

Create
For a new record, the event message body includes all non-empty fields and system fields, such as the CreatedDate and OwnerId fields.
Update
For an updated record, the body includes only the changed fields. It includes empty fields only if they are updated to an empty value (null). It also includes the LastModifiedDate system field. The body includes the LastModifiedById field only if it has changed—if the user who modified the record is different than the previous user who saved it.
Delete
For a deleted record, the body doesn’t include any fields or system fields.
Undelete
For an undeleted record, the body includes all non-empty fields from the original record, in addition to system fields.

Apex Change Event Messages

Fields in a change event message are statically defined, just like in any other Apex type. As a result, all record fields are available in the change event message received in an Apex trigger, regardless of the operation performed. The event message can contain empty (null) fields.

Create
For a new record, the event message contains all fields, whether populated or empty. It includes fields with default values and system fields, such as CreatedDate and OwnerId.
Update
For an updated record, the event message contains field values only for changed fields. Unchanged fields are present and empty (null), even if they contain a value in the record. The event message also contains the LastModifiedDate system field. The body includes the LastModifiedById field only if it has changed—if the user who modified the record is different than the previous user who saved it.
Delete
For a deleted record, all record fields in the event message are empty (null).
Undelete
For an undeleted record, the event message contains all fields from the original record, including empty (null) fields and system fields.