+ Start a Discussion

Two Triggers will fire at a time?

Hi All,


I have 4 objects A,B,C,D. B is related list for A. so A object can contain B1,B2,B3.. record. On A object i am writing a trigger (after insert) to copy records from B1 to Bn and save values on C (like c1,c2,c3..) object. Up to here it is working fine. But i am writing one trigger on C (after insert) copy the values c1,c2,c3.. and save on D object but here i can able to see only Dn record i can't able to get D1,D2..., only final record is creating. Whether 2nd trigger will fire after 1st trigger?


Any idea plz........





This post makes no sense whatsoever.  I will try to answer it anyway.


Apex triggers that create other objects will trigger other Apex triggers.  However, they are collectively subject to the limits.  Consider, for example, the 20-query limit.  Let's say trigger A has 10 queries.  It causes trigger B to fire, and trigger B has 10 queries.  That causes trigger C to fire -- but trigger C has more than 1 query, and so trigger C won't fire successfully because it puts the collective set of triggers over the limit for queries.


I agree that it's difficult to understand what you're trying to accomplish.


If I read it right, why don't you fire one trigger on A to copy B1-Bn to C and D.  That way you can monitor the governing limits from within that class at run-time?


If there are scenario's where C needs to copy records to D that are NOT coming from B, pass in another parameter that helps determine where this is data is coming from.


I don't know.  I can't tell if you are looking for suggestions or thinking out loud in a stream of consciousness.