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
Damon LimDamon Lim 

Recall approval process by non submitter through APEX

Hi, 

I have a case where I need to assigned approval user (non submitter) to recall the approval process. The recall code works well for submitter but for non submitter, I got the below error:

Process failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

Is there a way to "force" recall in APEX ? 

Thanks.
 
Best Answer chosen by Damon Lim
VineetKumarVineetKumar
If you have selected Allow submitters to recall approval requests option the only the submitter and the system admin will be able to recall that approval process.
Said that, you should make sure the Allow submitters to recall approval requests option is selected for the approval process and the code is executed in a sysadmin's context (what I'm assuming is that your apex class is a with sharing class, is yes then use without sharing and try). 

Let me know if this helps.

All Answers

VineetKumarVineetKumar
If you have selected Allow submitters to recall approval requests option the only the submitter and the system admin will be able to recall that approval process.
Said that, you should make sure the Allow submitters to recall approval requests option is selected for the approval process and the code is executed in a sysadmin's context (what I'm assuming is that your apex class is a with sharing class, is yes then use without sharing and try). 

Let me know if this helps.
This was selected as the best answer
Damon LimDamon Lim
Hi VineetKumar,

Yes, without sharing will run in System Context and force the Recall action on Approval Process.

Thanks for sharing.