My question could be a duplicate of another question that has been asked long back but without a concrete suggestion/solution.
Submitted user is also getting Reassign | Approve/Reject button on record
I have created multiple approvals through Apex and submitted as a non-admin user.
But, the biggest issue is, I am still able to see Reassign and Approve/Reject links for the approvals which I have submitted.
Actually, those approval requests have to be handled by the users Jon and Park in this case.
Any thoughts on why I am getting Reassign, Approve/Reject links even I am being as a submitter. I can adjust with Reassign link but I do not want Approve/Reject links which are not meaningful. Please see the screenshot below.
Experts, please advise. Thanks.
Code snippet:
List<Id> approvers = new List<Id>{'005o0000000POyp','005o0000000POyo','005o00000033qPS','005o0000000POyn','005o0000001z4Qz','005o0000000P6Y0','005o0000000POyl','005o0000002mdGZ','005o0000000POzf','005o0000000PZSU','005o0000002H8kV','005o0000003ZFd0'};
List<Approval.ProcessSubmitRequest> appreqs = new List<Approval.ProcessSubmitRequest>();
for (Id appId : approvers) {
Approval.ProcessSubmitRequest req = new
Approval.ProcessSubmitRequest();
req.setComments('Need approval. Product sample quantity is beyond the limit.');
req.setObjectId('006o000000GN07w');
req.setNextApproverIds(new List<Id>{appId});
appreqs.add(req);
}
List<Approval.ProcessResult> ApprovalReqs = Approval.process(appreqs);
Best Answer
Us the Approval set to Unanimous and not First Approver for Approvals for this section of the Approval process?
If you look at the MetadataAPI for approval processes here, specifically the section on ApprovalStepApprover that would give you the reference you need. If you would like to modify the approval process from Apex you would need to download the one of the wsdl either developer or enterprise and then use the wsdl2apex tool in salesforce to generate a wrapper, or it would be easier to use Andy Fawcett's version of it where he already did most of the cleanup work.