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
Rahul Kumar 242Rahul Kumar 242 

Update a checkbox on Account after update

I have created a checkbox SendToSAP on account, which should be 'true' when a record gets created or every time it gets updated. I have set the default value of flag to true and written a trigger on account to set it to true after update.
But the problem is when i am trying to make this flag 'false' through my apex code the trigger is again setting it back to true. so i am unable to set my flag to 'false' in any case.
Can anyone suggest me the workarround for this problem.

Thanks in Advance!
shiva pendemshiva pendem
HI Rahul,

Take any other check box field and update that field as true via your apex code and check for that field in trigger .

if(SendToSAP==false && Newfield==false){
    update the SendToSAP as true;
}

Hope this will helps you.

Thanks,
Shiva



 
erksfdcDeverksfdcDev
Hi Rahul,

try to use Recursive functionality.

Please go through the follwing link.
https://help.salesforce.com/apex/HTViewSolution?id=000133752&language=en_US

Thanks.