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

clone recursion

I needed a trigger to create clone of account record on insert.
To avoid recursion I have used a boolean. Is there any method to stop recursion that can be used in this place.
public class CloneAccountTriggerHandler {
public static Boolean cloneRecord = true;
Method : cloneAccountRecord
Type : Test Method
Description : Method To create Clone of Account Record when inserted
public static List<Account> cloneAccountRecord(List<Account> newAccount){
List<Account> listAccount = new List<Account>();
if(cloneRecord) {
cloneRecord = false;
for(Account account : newAccount) {
return listAccount;
Hello Ayisha,
Static Boolean variable is used to stop recursion. Are you facing any issue in the above code because it seems to be working fine to avoid recursion.
Its working fine. I need to know what are the other methods that i can use to stop recursion