+ Start a Discussion
Surender reddy SalukutiSurender reddy Salukuti 

recursive trigger @ circular trigger

Hi every one,

What is recursive trigger ? and where it is yousefull in real time and how it handel?

what is circular trigger ? and where it is usefull how its handele?

plese tell me answer if any one know a bout this.

Thank you,
Surender Reddy.
Recursive Trigger is one which enters into an infinite loop as same code is executed again and again. To avoid this create a class with a static boolean variable with default value true.
In the trigger, before executing your code keep a check that the variable is true or not.
We shoud avoid the recursive trigger.

Not aware if there is something like Circular Trigger but it can be as if we fire a trigger on Account insertion and  a contact is created.Another trigger on contact object, when we insert contact record then account also inserted.
Deepali KulshresthaDeepali Kulshrestha
Hi Surender,

If a trigger is called again and again than it is called a recursive trigger.

For Eg:
trigger on Contact (before update){
update anyContactList;

In the above example, we are updating contact list in before update trigger so it will again call the trigger and our trigger will be called recursively till we stop or block it with the help of a static variable. Circular and recursive triggers are basically the same.

1. Many Developers face recursive trigger or recursive update trigger. For example in ‘after update’ trigger, Developer is performing update operation and this lead to the recursive call.

2. You want to write a trigger that creates a new record; however, that record may then cause another trigger to fire, which in turn causes another to fire, and so on.

Hope this helps

Thanks and Regards,
Deepali Kulshrestha
Ujwal KumarUjwal Kumar
Hi Surender reddy Salukuti,

If the problem is caused by the same trigger, then we call that as a recursive trigger, On the other hand, if the problem is caused by other trigger and make infinite loops, then we call this as Circular trigger. 

We can handle both, by creating a class with a boolean flag.