I've been playing around with change event triggers to get an understanding of them and I noticed that if my objects have fields with default values, those fields are being included in the update change event. These include all checkboxes and other fields such as numeric fields that have a specified default value.

For example, I enabled change data capture on opportunity and then wrote a simple trigger to see what is coming into the trigger.

trigger OpportunityChangeEventTrigger on OpportunityChangeEvent (after insert) {
    for (OpportunityChangeEvent event : Trigger.New) {

If I look at the debug log for the automated process user, I see more fields than I actually changed on an opportunity update.

How can I tell which fields were actually changed using a change event trigger?


1 Answer 1


Answer from John Brock at Salesforce:

This is not expected behavior and we have a bug logged. If you have a case filed, please let me know so I can get it linked up to the right ticket. The expected behavior is that unchanged fields shouldn't have a value which could be misinterpreted as a change -- or we need to provide information for you to make this determination. Nulled fields should be identified using the nulledFields array in the ChangeEventHeader. In Winter [20] or Spring [20], we will likely replace nulledFields with changedFields to make this distinction of change field values more explicit.

Known Issue: https://success.salesforce.com/issues_view?id=a1p3A0000003cyRQAQ


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .