0

I have Account object which have two Trigger, one trigger has events before insert and after insert second trigger has after insert event.

So which trigger will fire after the record is saved ?

1
  • Their is no reason second trigger wont fire could you please make sure that trigger is active. Mar 25, 2015 at 19:30

1 Answer 1

3

Both - ideally you should only have one trigger per object. The issue with having multiple triggers, with the same event on the same object, is you cannot guarantee the order that they will execute.

From the Salesforce order of execution documentation: https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm

The order of execution isn’t guaranteed when having multiple triggers for the same object due to the same event. For example, if you have two before insert triggers for Case, and a new Case record is inserted that fires the two triggers, the order in which these triggers fire isn’t guaranteed.

Also more information here: Order of execution of trigger and workflow

If I had seen that answer before I probably would have flagged this question as a duplicate...

9
  • thanks for quick response. there is any documentation from salesforce related to this Case ?
    – Vivek P
    Mar 25, 2015 at 11:12
  • I what to know weather Both Triggers will be executed or not ?
    – Vivek P
    Mar 25, 2015 at 11:15
  • Added more detail in my answer, but you can easily see what triggers fire by either using the developer console or the debug logs.
    – Girbot
    Mar 25, 2015 at 11:23
  • As per my understanding both the Triggers will execute but we will not be able to define the order of execution, am I Write Girbot
    – Vivek P
    Mar 25, 2015 at 11:32
  • Yup that's my understanding.
    – Girbot
    Mar 25, 2015 at 12:10

You must log in to answer this question.

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