PranavNagrecha/AwesomeSalesforceSkills / skills/admin/assignment-rules
assignment-rules
VerifiedUse this skill when configuring or troubleshooting Lead or Case assignment rules in Salesforce: creating rule entries, setting filter criteria, assigning records to users or queues, understanding when rules run, and implementing round-robin patterns with Apex. Trigger keywords: lead assignment, case assignment, assignment rule, queue assignment, auto-assign. NOT for creating the queue or public group a rule routes into — use admin/queues-and-public-groups. NOT for Omni-Channel or skills-based routing — use admin/omni-channel-routing-setup. NOT for approval routing — use admin/approval-processes.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 21.6 KB |
| references/examples.md | markdown | 6.4 KB |
| references/gotchas.md | markdown | 10.5 KB |
| references/llm-anti-patterns.md | markdown | 5.9 KB |
| references/metadata-examples.md | markdown | 13.5 KB |
| references/migration-and-sandbox.md | markdown | 4.1 KB |
| references/routing-selector.md | markdown | 3.7 KB |
| references/testing.md | markdown | 4.4 KB |
| references/troubleshooting.md | markdown | 6.0 KB |
| references/well-architected.md | markdown | 4.9 KB |
| scripts/check_assignment_rules.pyexecutable | script | 13.0 KB |
| templates/assignment-rules-template.md | markdown | 2.9 KB |
references/routing-selector.md
View on GitHub# Routing Selector — Assignment Rules vs Omni-Channel vs Flow vs Apex vs Territories vs Scoring
`standards/decision-trees/automation-selection.md` decides Flow vs Apex for general logic. It does not cover ownership routing, where the declarative rule engines are usually the right first answer. Use this page when the question is "who should own this record, and what should set that".
## Pick by need
| Need | Use | Why not the others | Skill |
|---|---|---|---|
| Route a new Lead or Case to a user or queue from field values | **Assignment rule** | Zero code, admin-maintained, up to thousands of ordered entries; Flow would re-implement the same criteria table | this skill |
| Same, but on any other object (Account, Opportunity, custom) | **Record-triggered Flow (before-save) setting `OwnerId`**, Apex if the lookup logic needs code | Assignment rules exist only for Lead and Case | `flow/record-triggered-flow-patterns`, `apex/trigger-framework` |
| Distribute work from a queue to whichever agent is available and has capacity | **Omni-Channel** (queue-based or skills-based routing) on top of an assignment rule that lands the record in the queue | Assignment rules pick a queue, never a person inside it; Apex round-robin ignores presence and capacity | `admin/omni-channel-routing-setup` |
| Equal distribution among a fixed rep list, no Omni-Channel licence | **Apex trigger with a counter** (Custom Setting) | Flow counter is unsafe under concurrent inserts; rules have no rotation concept | this skill, Common Patterns |
| Geography or account hierarchy ownership for Accounts and Opportunities | **Enterprise Territory Management** | Assignment rules do not run on Accounts; Flow cannot maintain a territory model | `admin/enterprise-territory-management` |
| Prioritise or tier leads before routing | **Lead scoring writes a score field; the assignment rule routes on it** | Scoring (Sales Cloud or Account Engagement) never sets an owner by itself | `admin/lead-scoring-requirements`, `admin/mcae-lead-scoring-and-grading` |
| Re-route or notify when a Case is unresolved past a time threshold | **Escalation rule** (Case only), or entitlement milestones for SLA tracking | Assignment rules fire once at create; a scheduled Flow re-implements the escalation engine | `admin/escalation-rules`, `admin/entitlements-and-milestones` |
| Control who owns the Account / Contact / Opportunity created on lead convert | **Lead conversion Apex or Flow** | Assignment rules do not run during conversion | `apex/lead-conversion-customization` |
| Third-party routing product (LeanData-style, RevOps tools) owns assignment | **Treat it as an integration** | Two writers of `OwnerId` produce flip-flopping owners; either it passes the assignment header and the rule stays authoritative, or the rule is deactivated and the product is | this skill, gotchas #1 |
## The standard Service Cloud stack
Assignment rule (lands the Case in the right queue) → Omni-Channel (pushes it to an available agent) → Escalation rule or milestones (acts when it sits too long). Each layer answers a different question; skipping the first and pointing Omni-Channel at every Case is the most common way to lose the criteria audit trail.
## Five questions that settle it
1. Is the object Lead or Case? If not, assignment rules are off the table.
2. Is the target a queue or a person? Queues are resilient to staff changes; people are not.
3. Does someone need to be *available* to receive it? Then Omni-Channel, not a rule or Apex.
4. Is the routing key a computed value (score, tier)? Compute it first (Flow or scoring), route on the plain field second.
5. Does anything else write `OwnerId` after save? If yes, decide which writer is authoritative and remove the other (`references/troubleshooting.md`, step 5).
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |