+ Start a Discussion
Ranadheer chRanadheer ch 

How to control the excution of 2 triggers ...so here

How to control the excution of 2 triggers ...so here i have 3 triggers for an object ..so here i want to control those  triggers excution order...for example i have trigger1,trigger2,trigger3..........here what i need is first trigger2 should fire, after that trigger1 should fire, finally trigger3 should fire ...how can i achive that ? this is actually my interview question....help me ...thanks in advance
John PipkinJohn Pipkin
You cannot control the execution of triggers (if multiple before or after  triggers exist for the same object). The only way to ensure the code gets executed in order is to only have 1 before and 1 after trigger per object. So the answer I would give is to combine the triggers. See this article for more detailed info about Order of Execution: https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm

Hope that helps