Below is my code snippet that I have used. And also I used static Boolean to handle the recursive call.
But when I update more than 200 records then trigger only process first 200 record not all the records after 200.
So I think this is not a best solution to use static Boolean variable.
So what will be the best solution for this ?
trigger RN_Account on Account (after update)
{
RN_AccountHandler handler = new RN_AccountHandler();
if(Trigger.isAfter && Trigger.isUpdate && RN_AccountHandler.isUpdate)
{
RN_AccountHandler.isUpdate = false;
handler.onAfterUpdate(Trigger.newMap, Trigger.OldMap);
}
}
Handler
public with sharing class RN_AccountHandler
{
public static Boolean isUpdate = true;
public void onAfterUpdate(map<Id, Account> mapNewAccount, map<Id, Account> mapOldAccount)
{
system.debug('========mapNewAccount.values()============'+mapNewAccount.values().size());
}
}
I have added RN_AccountHandler.isUpdate
to handle the