You need to sign in to do that
Don't have an account?
mukesh gupta
Script stop on addError in apex
Hi Expert,
I am using add error method, when criteria match then addError method call, but here script doenot stop and execute next loop.
i want to stop script when addError call. i have used break; return; but nothing happen
Thanks
Mukesh
I am using add error method, when criteria match then addError method call, but here script doenot stop and execute next loop.
i want to stop script when addError call. i have used break; return; but nothing happen
for (Opportunity currOpp: newOpportunities_1){ System.debug('currOpp name '+currOpp.name); if (currOpp.RecordTypeId!=PMRecordTypeId.Id ){ currOpp.addError(Label.pmr); } } for (Opportunity currOpp: newOpportunities_2){ System.debug('currOpp name '+currOpp.name); }
Thanks
Mukesh
Try using return null;?
Thanks,
Can you please share the code and the context in which are trying to achieve the required functionality?
Were you able to get this working? You hasn't shared the code?