
if(aIBDMap.get(c.SFDC_Account_Name__c) != null) //experimental code. { System.debug('ProtAcc'+t.Protected_Accounts__c); if(c.State__c== t.state__c && c.Zip_Code__c.substring(0,5) >= t.zip_start__c &&
c.Zip_Code__c.substring(0,5) <= t.zip_end__c && aIBDMap.get(c.SFDC_Account_Name__c).channel__c == t.channel__c &&t.type__c =='Annuity'&&t.Protected_Accounts__c == null) { System.debug('Entry Test2'+t.Protected_Accounts__c); c.Annuity_Territory__c = t.Id; System.debug('The current ID is >>' + t.Id); } } catch (System.Exception e) { System.debug(e.getMessage()); //c.addError('[Error AC] There was an unexpected error while saving the record, please Contact support for assistance'); } }
1 answer

This looks to be a trigger code. Do you have any workflows this object having the trigger. If you have deactivate them and then test. If it works fine then it would mean that this trigger running recursively. Once it met if and it does not so it goes in else. If that is the case than use static boolean varible to stop recurssion.ThanksShashikant