+ Start a Discussion
Jay KanchanaJay Kanchana 

Trigger Execution order with a field update and a formula field


   We have a Date field that gets set in the 'before update' trigger. This date field is used in a formula field. This  formula field is in turn used to calculate another field in the trigger.

1. Will the 'before update' trigger see the revised formula field value? Based on my testing, the answer appears to be No.
2. The 'after update' trigger also does not appear to have the revised formula field value. It appears that we must query the record again in the 'after update' trigger. 

Is the best way to query again in the after update to retreive the new formula field value? I have the recursion stopping static variable in the trigger supporting class. Is there any issue with that when we bulk upload the data using demand tools or data loader?

I am puzzled because we have had the 'before update' trigger working for an year  and the field was being calculated in the before update trigger. It stopped working recently. May be it was not supposed to work and the best solution has always been to requery in 'after update'?

Thank you!