You need to sign in to do that
Don't have an account?
fer_far
Distinguish between cascading triggers or directly fired from operations
Hi,
How can I distinguish when a trigger is fired from another trigger (cascading) or directly from a database save operation (not fired from another trigger)?
I've been looking for this in Apex Help documents without any success.
Thanks in advance.
Just happened to see this while looking for something else - HTH.
Look in the Apex Code Developers under Using Static Methods and Variables. Snippet from that section is:
Use static variables to store information that is shared within the confines of the class. All instances of the same class share a single copy of the static variables. For example, all triggers that are spawned by the same request can communicate with each other by viewing and updating static variables in a related class. A recursive trigger might use the value of a class variable to determine when to exit the recursion.
Suppose you had the following class:
A trigger that uses this class could then selectively fail the first run of the trigger: