Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

While the apex developer documentation provides sample code on submitting an sObject to an approval provess with apex there is no documentation on how to recall an item from the approval process.

Is this possible? If so, how is it done?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

This is possible by setting the action on a ProcessWorkItemRequest to "Removed". Depending on the configuration of your approval process this option may only be available to system administrators. If the approval process is set to "Allow submitters to recall approval requests" then the submitter of the record can also recall it.

Sample apex:

Approval.ProcessWorkitemRequest PWR = new Approval.ProcessWorkitemRequest();
PWR.setComments(approverComment);
PWR.setAction('Removed');
PWR.setWorkitemId(record.Id);
Approval.ProcessResult result =  Approval.process(PWR);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.