Here's the class with the static share property:
public with sharing class MyClass {
public static set<ID> updateMethod = new set<id>();
}
Then added to the trigger:
for(Lead Lee:trigger.old){
if(!MyClass.updateMethod .Contains(Lee.Id) && !Leads1.isempty() && Trigger.isAfter ){
MyClass.updateMethod .Add(Lee.Id);
ClsName.MethodName(Leads1); // rest Api class and method
}
Else{
MyClass.updateMethod .Remove(Lee.Id);
}
}
}
public with sharing class MyClass {
public static set<ID> updateMethod = new set<id>();
}
Then added to the trigger:
trigger MyTrigger on Lead (before
update
, after
update
) {
for(Lead Lee:trigger.old){
if(!MyClass.updateMethod .Contains(Lee.Id) && !Leads1.isempty() && Trigger.isAfter ){
MyClass.updateMethod .Add(Lee.Id);
ClsName.MethodName(Leads1); // rest Api class and method
}
Else{
MyClass.updateMethod .Remove(Lee.Id);
}
}
}