You need to sign in to do that
Don't have an account?
Ryan Werner 22
Approval process through Apex - setting a submitter Id security context
In our implementation we originally had security on an object set to Public Read/Write. Along with this we have Apex functionality to submit a record for approval where the person submitting is not the record owner, but the Apex they are invoking is setting the setSubmitterId to the record owner's Id.
Now we want to tighten security on this object to Private and it is breaking our Apex code. I am having trouble debugging and truly identifying the issue, but my assumption is even though the Apex code being invoked is setting the submitter Id as the record owner, since the Apex itself is being run by a different user, the approval process is failing to run since the person running the Apex itself isn't the record owner and sharing is private.
Is it correct to assume an approval process runs in the context of who invokes it, and not who is set as the submitter Id?
Now we want to tighten security on this object to Private and it is breaking our Apex code. I am having trouble debugging and truly identifying the issue, but my assumption is even though the Apex code being invoked is setting the submitter Id as the record owner, since the Apex itself is being run by a different user, the approval process is failing to run since the person running the Apex itself isn't the record owner and sharing is private.
Is it correct to assume an approval process runs in the context of who invokes it, and not who is set as the submitter Id?
Hi Ryan
The Approval process run in system mode, try using without sharing key word in your apex.
If it resolve the issue, please mark it as best answer.
regards,
Priya Ranjan