function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kt YadavKt Yadav 

Hi ,Recursive future call handle from Out of the box

I have one custom object and trigger for insert and inside trigger there is future call  and one batch class  doing insert on same object so to prevent recursion  how will i handle it out of box, no business logic.
Is there any way we can handle it from Out of box without writing any custom logic?

All Answers

sumit singh 37sumit singh 37
create another class and a static variable in the class. and use that variable in the trigger to stop recursion,
public class triggerhandler
{
    public static boolean isRepeat;
}


trigger callRemoteaction on Account (after insert, after update) 
{
if(triggerhandler.isRepeat!= true)
    {
       triggerhandler.isRepeat = true;

     // perform your action 

   }
}