Sub topic 5
Choosing approvers
This chapter assumes you know how an approval process is built from entry criteria and steps, and that you understand users, roles, and queues. Here you decide who receives each approval request.
Where approvers are set
You choose approvers on each approval step. Different steps can use different approvers, so a discount request can go to a manager first and to finance second.
A step offers two ways to pick approvers:
- Let the submitter choose manually. The submitter picks the approver when submitting. Use this when the right person varies and no field on the record identifies them.
- Automatically assign. The process picks approvers from rules you define. This is the usual choice because it is repeatable and does not depend on the submitter.
Approver types
An automatic assignment can use any of these types.
| Approver type | Who receives the request | Typical use |
|---|---|---|
| User | One named user | A fixed approver such as a finance lead |
| Queue | Any member of the queue can act | A shared team such as Legal |
| Related user | A user found through a field on the record, such as Owner or a user lookup | The record owner's manager, or an account sponsor |
| Manager hierarchy | The submitter's manager, found through the Manager field or a custom user hierarchy field | Escalation up the management chain |
A related user is resolved when the record is submitted. If the lookup field is empty, no approver exists for that step. Make sure the field is populated, or add step criteria that skip the step when it is blank.
A queue request sits in the queue until one member acts on it. Queue members see it in their approval requests list.
Delegated approvers
A user can name a delegated approver on their user record. The delegate can approve or reject on that user's behalf. This helps when an approver is on leave. The delegate does not replace the approver. The original approver can still respond.
Check that the approval process allows delegated approvers. Setting the field on the user is not enough.
Choosing by situation
The diagram shows a simple way to decide.
Setting the approver from Apex
You can also set the approver at submission time in Apex. This is useful when the process lets the submitter choose and code does the submitting.
public with sharing class DiscountSubmitter {
public static Approval.ProcessResult submit(Id opportunityId, Id approverId) {
Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setComments('Submitting discount request for approval.');
req.setObjectId(opportunityId);
req.setNextApproverIds(new List<Id>{ approverId });
return Approval.process(req);
}
}setNextApproverIds only works if the first step lets the submitter choose approvers. If the step assigns automatically, the process uses its own rules.
Common errors
- The approver field is empty. A blank manager or user lookup causes the submission to fail. Fill the field or add step criteria that avoid it.
- The approver cannot see the record. Approvers must be able to open the record. Check sharing and permissions if a request does not appear for them.
- A queue was expected to notify everyone. Notification depends on the email settings of the queue. Check that the queue has an email address or that members receive notifications.
- A delegate cannot act. Confirm that the process allows delegated approvers and that the delegate field is set on the right user.
Exercise
A step must go to whoever manages the opportunity owner. Which approver type fits, and what must be true of the data for it to work?
Show answer
Use the manager hierarchy, or a related user that points to the owner's manager. The owner's Manager field must be filled in. If it is blank, the step has no approver and the submission fails unless step criteria skip it.
Exercise
What is the practical difference between assigning a step to a queue and to a delegated approver?
Show answer
A queue request can be acted on by any queue member, and that group is the intended approver. A delegated approver is a stand-in set on one user's record, and the original approver can still respond.