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
vineet kumarvineet kumar 

Assigning Approvers through Apex to different steps (Dynamically) of a Multistep Approval

Hi All,

Scenario is given below. 

On Account, I have an approval process. and it's multistep approval. 
Let's assume its a 2 step approval.
but in the approval steps, No approvers are mentioned.
for the approvers, we are not having user lookups on Account but
We have an Account Role object (Child of Account) from where approvers will be picked up dynamically based on the role (field on the object level) of the user.

Now suppose in the Account Role we have 3 users (3 records which contains user with the role) with the role Manager so in that case, approvers in the "first step" will be these 3 users and any of them can approve the record, and once approved the record will go in the next step to be approved.

Now I want to assign approvers dynamically in each step of the approval as explained in the above scenario.

Can I call the same defined approval in apex and then in apex set the approvers in different steps and fire the approval??

Any suggestions would be appreciated.

Thanks.

 
ShirishaShirisha (Salesforce Developers) 
Hi Vineet,

Greetings!

Can you please check the below thread which might help you in achieving your requirement as there are no direct documentations available according to your business requirement.

https://salesforce.stackexchange.com/questions/16552/how-to-decide-approvers-dynamically-in-case-of-unanimous-approvers

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri