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
Abhishek Singh 88Abhishek Singh 88 

trigger is getting called twice ,even after using static variable.

Hi all,
My trigger is being called twice, even I have used a static variable. Please find the class.
public void decommissioning(List<Incident>newlist,map<id,incident>oldmap) 
{
      if(checkrecursive.run==true)
 {
       serverdecomissioning(newlist,oldmap);
    checkrecursive.run=false;
}
}
public void serverdecomissioning(List<Incident>newlist1,map<id,incident>oldmap1)
{
//code
}

 
Avishek Nanda 14Avishek Nanda 14
HI Abhishek,

Where are you setting this variable to True ? and checking here ..

Please check this article given by Salesforce. 

https://help.salesforce.com/articleView?id=000332407&type=1&mode=1

Regards,
Avishek 
Abhishek Singh 88Abhishek Singh 88
Hi Avishek,
I have a object called "Base Relationship" which have two lookup Field with same object i.e. "Base Element" name of lookup field is"Destination"And "Source".So basically I have trigger on "base element as (Destination)" where i am getting "source " id and updating the records related to. It's causing recursive error. I created a class with a static variable and using it in trigger , but still trigger is firing more than once