3

I have an approval process in place for object K__c. In this approval process Next Automated Approver Determined By : Manager of Record Submitter

Now I want to set the Approver to a particular user u1 so i'm executing the following piece of code from developer console :

List<Approval.ProcessSubmitRequest> requests = new List<Approval.ProcessSubmitRequest>();Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();

            req.setComments('Approving KOL.');
            req.setObjectId('a4b2400000001eu');
            req.setNextApproverIds(new List<Id>{'00524000001SdlVAAS'});
            requests.add(req);List<Approval.ProcessResult> results = Approval.process(requests);

When this code is getting executed, the record enters into the approval process, but the Approver is set to some different user, ux, not in any connection with the role hierarchy of desired user u1.

Then I deactivated the user ux and executed the same code and error comes out:

System.DmlException: Process failed. First exception on row 0; first error: MANAGER_NOT_DEFINED, Manager undefined.: []

Please suggest.

0

For some reasons Determined By : field takes priority over setNextApproverIds.

You can not set manually approving user with this setting in Determined By.

Try setting it to None and code will work.

-1

Go to initial submitter User-->Edit-->update the Manager in Manager tab.

Manager Lookup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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