I'm writing a rollup trigger to update a field at account level based on some criteria. Let's say there's a boolean field with true/ false values.

Should I check if the value has changed at original object before updating this field in my trigger ( for optimizing trigger performance )? ( Also meaning that I will include this field in a query ).

If the value is the same in both cases, will salesforce commit a change ( changing value to the same value ) or will salesforce be smart enough to skip the record if no change occurred?

1 Answer 1


A simple way to check for that would be to put a formula field on the child object that tells you the value of the parent field. Then you don't even need to query; just check the value in the formula field and decide if you want to process.

for (MyObject__c obj : Trigger.new)
    if (obj.Formula_to_ParentField__c != correctValue)
        //process this record

To answer your other question: If you include a record in an update call, it will do the update and run triggers and workflows and change the LastModifiedDate, even if there are no field value changes.

You must log in to answer this question.

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