Created
March 14, 2022 18:35
-
-
Save emoran/a54033e54d3dc2b11e16dee16ede7053 to your computer and use it in GitHub Desktop.
Check recursive apex in Salesforce.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Class CheckRecursive { | |
private static boolean run = true; | |
public static boolean runOnce(){ | |
if (run) { | |
run = false; | |
return true; | |
} | |
else{ | |
return run; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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