Sub topic 15
Design considerations, limits, and alternatives
This chapter closes the tutorial. It covers how to decide whether an approval process is the right tool, how to design one that stays maintainable, and which limits and failure modes to plan for. It assumes you have read the earlier chapters on entry criteria, steps, approvers, record locking, and the Apex Approval API. You should also know the basics of Flow and validation rules.
When an approval process is the right tool
An approval process fits when all of these are true:
- A human must make a decision about a record before work continues.
- The decision is a clear yes or no.
- The route can be described as ordered steps, with approvers chosen by user, queue, role hierarchy, or a field on the record.
- You want locking, history, and email response without writing code.
It fits poorly when you need parallel branches, conditional paths that depend on many variables, or approval of something other than a single record. Examples are a bundle of records approved together, or an approval with several different outcomes such as "approve with changes".
Alternatives and how to choose
| Need | Better option | Reason |
|---|---|---|
| Block a save when data is invalid | Validation rule | No human decision is needed. |
| Simple "ask someone to review" with no lock | Flow with a screen or task, plus a status field | You control the whole experience and can branch freely. |
| Multi-stage business process with several people and parallel work | Flow-based orchestration or newer flow-based approval features | They model stages, parallel steps, and work items. Check availability for your edition and release. |
| Complex quote or pricing approvals with dynamic approver chains | A managed package such as Salesforce CPQ Advanced Approvals, or custom Apex | Standard steps cannot generate approver chains from line-level data. |
| Approval triggered from custom UI or an integration | Standard approval process plus the Apex Approval API | You keep locking and history but control the entry point. |
A useful rule of thumb: start with a standard approval process. Move to Flow or code only when you can name the specific requirement it cannot meet.
Design considerations
Keep processes few and entry criteria exclusive
A record can be in only one pending approval process at a time. If several processes on an object have overlapping entry criteria, Salesforce uses the process order you set on the object's approval process list. The first process whose criteria match is the one used. Overlap makes behavior hard to predict.
- Write entry criteria so that exactly one process matches any given record.
- Prefer one process with several steps, each with step criteria, over many near-identical processes.
- Put a clear, ordered naming scheme on processes, such as
Opp_Discount_01_Standard.
Decide what happens when criteria fail
Each step lets you choose what happens when a record does not meet the step criteria. You can skip the step, approve the record, or reject it. Choose deliberately. "Approve the record automatically" is a common source of surprise, because it bypasses a human on any record that misses a criterion, including records with a blank field the criteria depend on.
Do not tie approvals to individual people
Naming individual users as approvers breaks when they leave, change role, or go on vacation. More durable choices:
- Queues, so any member can act.
- A manager or related-user lookup field on the record.
- Delegated approvers set on user records, for planned absences.
Also decide what happens when no approver can be found. You can set the process to require manual assignment or to hand the request to a named fallback. A request with no approver stays locked and unnoticed, so always define a fallback.
Plan the locking model
A record under approval is locked. By default only administrators can edit it. You can also allow the currently assigned approver to edit it. Think about these cases before you build:
- Automation that must update the record during approval, such as a flow. Flows that run as a user without edit access can fail with a locking error.
- Child records. Locking applies to the record, not to related records. Users can usually still change child records, which can undermine what the approver is looking at.
- Recall. If submitters cannot recall their own requests, a mistaken submission needs an administrator to unlock the record.
Make it testable and deployable
Approval processes are metadata, so deploy them with change sets or the Metadata API like other configuration. Test each path in a sandbox: approval, rejection, recall, and an unavailable approver. Be cautious with changes to an active process. In-flight requests can be affected by how the process is edited or deactivated, so check the current documentation and rehearse the change in a sandbox first.
Limits to know
Approval processes have platform limits. Salesforce changes these between releases, so confirm the numbers in the current "Salesforce Limits" and approval process documentation. These are the ones that tend to matter:
- The maximum number of steps in one process is capped (30 at the time of writing).
- The number of approvers you can name in a single step is capped, and public groups, queues, and roles expand to many people without counting individually.
- The number of active approval processes per object and per org is capped.
- Apex governor limits apply when you call
Approval.process. Each call counts as DML work and can fire triggers and flows on the record.
Some behavior is a design constraint, not a numeric limit:
- A record can be in only one pending approval at a time.
- You cannot submit a record that does not exist yet, so you cannot submit from a
before inserttrigger. Submit from anafter inserttrigger or later, when the record has an Id. - Approval actions run in the order configured, and field updates fire the record's other automation, which can cause recursion if not guarded.
Bulk-safe submission from Apex
A common mistake is calling Approval.process inside a loop, once per record. Pass a list instead. The second argument controls whether one failure rolls back the whole batch.
public with sharing class ApprovalSubmitter {
public static List<Approval.ProcessResult> submitAll(Set<Id> recordIds) {
List<Approval.ProcessRequest> requests = new List<Approval.ProcessRequest>();
for (Id recordId : recordIds) {
Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setObjectId(recordId);
req.setComments('Bulk submission from ApprovalSubmitter.');
requests.add(req);
}
// false = partial success: failures are reported in the results, not thrown.
return Approval.process(requests, false);
}
}Check each ProcessResult with isSuccess() and read getErrors() for failures. Common causes are a record that does not meet entry criteria, a record already pending approval, or no approver found.
Common failure modes
| Symptom | Likely cause | Fix |
|---|---|---|
| "Submit for Approval" button is missing | No active process matches, or the user is not an allowed submitter | Check entry criteria and initial submitters. Add the button to the page layout. |
| `NO_APPLICABLE_PROCESS` error from Apex | Record fails entry criteria for every active process | Test the criteria against the record's actual field values. |
| Request stuck with no one to act | Approver field blank, queue empty, or user inactive | Add a fallback approver and validate the approver field before submission. |
| Flow or trigger fails on a locked record | Automation user lacks edit access while locked | Allow approver edits, run the automation with an administrator context, or move the update into an approval action. |
| Record auto-approved unexpectedly | Step criteria not met and the step is set to approve | Revisit the "if criteria not met" choice, and handle blank fields. |
| Duplicate emails or loops | A field update re-triggers automation that re-submits the record | Guard re-submission with a status check. |
A design checklist
- State the decision, the decider, and what happens on yes and no.
- Confirm an approval process beats Flow, a validation rule, or a package for this case.
- Make entry criteria mutually exclusive across processes on the object.
- Choose approvers that survive staff changes, and define a fallback.
- Decide who can edit during approval and who can recall.
- Define the "criteria not met" behavior for each step.
- Add a status field and write the actions that keep it current.
- Check automation that touches the record while it is locked.
- Test approve, reject, recall, and no-approver paths in a sandbox.
- Re-verify limits in the current documentation before release.
Exercise
A team wants a request approved by the manager, then by finance only if the amount is over 10,000, then by legal only if a "Contract Review" checkbox is true. They are considering three separate approval processes on the same object. What is the better design, and why?
Show answer
Use one approval process with three steps and step criteria. Step 1 has no criteria and goes to the manager. Step 2 has criteria Amount > 10,000, and step 3 has criteria Contract Review = true. For both steps 2 and 3, choose "skip this step" when the criteria are not met, so the record moves on. Three separate processes would have overlapping entry criteria, and a record can be in only one pending approval at a time. Overlap would make the process chosen depend on process order and would be hard to predict.
Exercise
A developer submits records for approval by calling Approval.process inside a for loop in an after insert trigger. What problems does this create, and how do you fix it?
Show answer
Each call counts toward governor limits, so a bulk insert of many records can exceed them. Build a List<Approval.ProcessRequest>, add one ProcessSubmitRequest per record, and make a single call such as Approval.process(requests, false). Then check isSuccess() and getErrors() on each result. Using false for allOrNone lets valid records succeed while failures are reported in the results.
Exercise
Name two situations where you would choose something other than a standard approval process, and name the alternative for each.
Show answer
Examples: (1) The route needs parallel work or several stages with different participants, so use Flow orchestration or newer flow-based approval features. (2) Approver chains depend on line-level data such as quote lines, so use a package such as CPQ Advanced Approvals or custom Apex. A validation rule is the right choice when no human decision is needed at all.