Sub topic 15
Design guidelines for a maintainable routing setup
This chapter assumes you can create queues, write assignment rules and escalation rules, and read basic SOQL. It pulls those pieces into a few design rules you can apply when you build or review a setup.
Start from the requirement
Each routing tool answers a different question. Pick the simplest one that meets the requirement.
| Requirement | Tool |
|---|---|
| Send new cases to a team based on field values | Assignment rules with queues |
| Push work to agents based on capacity and presence | Omni-Channel |
| Act when a contractual response or resolution time is missed | Entitlements and milestones |
| Reassign or notify when a case sits open too long | Escalation rules |
Escalation rules fit simple age-based needs. If the business promises different response times to different customers, use entitlements and milestones instead, because they track time per customer agreement.
Keep the structure small
A rule set that grows without limits becomes hard to read and hard to test. These habits keep it manageable.
- Keep one active assignment rule and one active escalation rule. Salesforce allows only one of each to be active at a time, so all logic lives in that rule's entries.
- Order entries from most specific to most general. Salesforce stops at the first entry that matches, so a broad entry placed early hides every entry after it.
- End the assignment rule with a catch-all entry that sends cases to a general queue. Without it, unmatched cases fall to the default case owner, which is easy to overlook.
- Route to queues, not to named users. A person who leaves or changes roles then requires a membership change, not a rule edit.
- Use a small set of clear criteria fields, such as Origin, Priority, and a product or category field. Avoid long formula criteria that nobody can read.
Name and document things
Use consistent queue names and API names. A queue named Tier2_Support is easy to find in a query and in Apex, as in WHERE Type = 'Queue' AND DeveloperName = 'Tier2_Support'. Apex that looks up queues by DeveloperName survives label changes, while lookups by label break when someone renames the queue.
Keep a short table of queues, their purpose, and their owners. Review it when teams change.
Plan for time and ownership
Escalation timing depends on business hours. Define them once, assign them to the escalation rule, and review holidays each year. A rule that counts weekend hours will escalate cases on Monday morning that nobody could have worked.
Decide who is responsible for each queue. A queue nobody watches is where cases go to age. Pair each queue with a list view or report, such as the open queued cases query from the monitoring chapter, and check it on a schedule.
Test before and after changes
Treat routing as code that needs tests.
- Keep a set of sample cases that cover each rule entry, including the catch-all.
- Create them in a sandbox through each channel you support, since Web-to-Case, Email-to-Case, and manual entry can behave differently about running assignment rules.
- After each change, rerun the samples and confirm the owner.
- For escalations, check the
IsEscalatedcases query to confirm the rule fires.
Common design mistakes
- Combining several tools on the same trigger point with no clear owner, so cases are reassigned twice.
- Hard-coding queue Ids in Apex instead of querying by
DeveloperName. - Forgetting that Apex inserts skip assignment rules unless you set
DMLOptions. - Escalating to a user instead of a queue, which fails when that user is out.
Exercise
A case is created by Web-to-Case with Priority High, but it lands with the default case owner instead of the Tier 2 queue. The assignment rule has a "Priority = High" entry for Tier 2. Name two design checks that could explain this.
Show answer
First, check entry order: an earlier, broader entry may match first and route the case elsewhere, or the case may match no entry and fall to the default owner. Second, confirm the rule is the active one and is applied for that channel, because Web-to-Case needs an assignment rule selected and Apex inserts need DMLOptions. A catch-all entry would also make unmatched cases visible in a general queue.