+ Start a Discussion
atulit27atulit27 

How to assign multiple approver to the approval process through apex code?

I am trying this code to assign multiple approvers to an existing approval process

 

Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();req1.

 

setComments('Submitting request for approval.');

 

req1.setObjectId(theId);

 

req1.setNextApproverIds(new Id[] {'00590000000OYw5', '00590000000OYw5'});

 

 Approval.ProcessResult result = Approval.process(req1);

 

but its giving exception that the required field missing at line

 

 Approval.ProcessResult result = Approval.process(req1);

 

Please help me out. How to assign multiple User ids as approvers to the approval process but only through apex code

 

Thanks

atulit27atulit27

 

Hi,

 

Please any ideas on this or any other work around to do it.

 

Thanks,

Atulit

SørenKrabbeSørenKrabbe

Facing the exact same issue. Have you managed to work around this yet, Atulit27?

jeremyyjeremyy

I believe you can only specify the approver for the next step in the process. You can't set approvers for all steps at once.

SylverGSylverG

Hi, Did you fix this in the end?

 

marcobmarcob
Hi,
i encounter a similar issue. I want to assign multiple users to approve the next step in the approval process. Anyone got any idea how to do this?
Regards,
Marco
Radek MatusiakRadek Matusiak
Any solution for this?
marcobmarcob

No, this is still not possible.
From the apex developer guide:

setNextApproverIds(nextApproverIds)
If the next step in your approval process is another Apex approval process, you specify exactly one user ID as the next approver. If not,
you cannot specify a user ID and this method must be null.

The signature is misleading, for it suggests that you can pass a list of approverIds.

public Void setNextApproverIds(ID[] nextApproverIds)

Regards,

Marco