You need to sign in to do that
Don't have an account?

Triggers order of execution
Hi,
If I put 2 triggers on same object, and they both set to run on same event (before insert), how can I tell and/or decide which one of them will run first?
Thank you,
Eran
If I put 2 triggers on same object, and they both set to run on same event (before insert), how can I tell and/or decide which one of them will run first?
Thank you,
Eran
There is no any specific assurance that which trigge wil fire first. Its better to to twrite one trigger and call two different handlers which will handle your two different use cases.
For example, you have trigger A and Trigger B. If you want to execute first triggerB and then trigger A.
Trigger:
trigger executePattern on Object(Before Insert){ // Mention all the event
if(Trigger.isInsert&&Trigger.isBefore){
executePatternHelperClass.BeforeEvent(trigger.New);
}
}
Helper Class:
public class executePatternHelperClass{
public static void BeforeEvent( List<sobject> newMap){
methodB();
methodA();
}
public void methodA(){
//your logic from triggerA
}
public void methodB(){
//your logic from Trigger B
}
}
Thank you for your replies!