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
naveen reddy 19naveen reddy 19 

How to recall an approval process in apex

Hi All,

 How to recall an approval process in apex.
We are using apex to dynmically submit for approval using below code.
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
                req1.setComments(APPROVALNAME);
                req1.setObjectId(qla.Id);
                Approval.ProcessResult result = Approval.process(req1);

We also need to dyncamically recall approval process. Can you please help in how to recall using apex. Is beolw code work only for admin or works for submitter as well.
 
Approval.ProcessWorkitemRequest pwr = new Approval.ProcessWorkitemRequest();
pwr.setAction('Removed');

Thanks,
Naveen
Best Answer chosen by naveen reddy 19
Kunal Mishra 33Kunal Mishra 33
Hi Naveen,

Can you try checking the below checkbox in your defined approval process.
Approval Process
It should work both for submitters and sys admins

Thanks,
Kunal