I'm struggle to find documentation on how the history tracking is handled respect the order of execution...

due to this I'm not understanding what happen to the system. I'm monitoring a simple action

I have this order execution

  • custom code execute and instantiate an SObject, in the execution is set the field myField__c (the field is in the history tracking, is a datetime ). At the end of the execution the code perform a DML (update)

  • On the dML executes a trigger, that trigger may re-assign e new value to the field myField__c on before update

in some cases i see that history tracking register two events on myField__c, which saying that the field has changed 2 times, is this what expected?

Where i can find when the field history tracking is executed in the order of execution?


1 Answer 1


set up debug logs and in the debug logs search for Myfield__c and you can clearly see where the value of your custom field is getting changed. Once you find where the value is getting set, scroll up or down in the debug logs to find exact trigger or declarative piece or apex class that is setting and changing your custom field value. In the logs you can also clearly check how many times each trigger is getting executed and the execution context. To avoid trigger reentrancy, use static variable design pattern to run the triggers only once. If you dont want your declarative pieces to fire triggers, define a custom field on your object called ByPassTriggerLogic__c and set it your declarative piece (workflowm process builder etc..) and use ByPassTriggerLogic__c value to know whether to execute the trigger or not. This way you can control the order of execution.

  • thanks for your feedback, and sorry for mine not clear question. I'm searching to understand when the history tracking is executed in the order of execution, and i was not able to find it in the documentation. Sure i can make debug and figure out when and how this happen, but I'm trying to figure out how the all process worsk, so to understand specific situation.
    – Klodj_Meta
    Commented Mar 17, 2020 at 15:59

You must log in to answer this question.

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