Skip to content

Instantly share code, notes, and snippets.

@emoran
Created March 14, 2022 18:35
Show Gist options
  • Save emoran/a54033e54d3dc2b11e16dee16ede7053 to your computer and use it in GitHub Desktop.
Save emoran/a54033e54d3dc2b11e16dee16ede7053 to your computer and use it in GitHub Desktop.
Check recursive apex in Salesforce.
public Class CheckRecursive {
private static boolean run = true;
public static boolean runOnce(){
if (run) {
run = false;
return true;
}
else{
return run;
}
}
}
trigger updateTrigger on SObject(after update) {
if(checkRecursive.runOnce()){
//Code here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment