Salesforce Lead Assignment Rules vs Flow: Who Routes?
Salesforce lead assignment rules vs Flow vs Apex: what each router does well, where each breaks, and why only one of them should own the lead owner.
Salesforce lead assignment rules vs Flow is usually framed as old tool versus new tool. That framing is why so many orgs end up with both of them setting the lead owner, and nobody sure which one won.
My position: assignment rules, Flow and Apex are each the right router for a different shape of routing. The mistake is not picking the “wrong” one. The mistake is letting more than one of them decide who owns the lead. Pick one owner of that decision, let the others prepare the data or react to the result, and automated lead routing and assignment stops being a mystery.
Here is how the three compare, and how to tell which one your routing actually needs.
What assignment rules are genuinely good at
Assignment rules are a lookup table with a UI. You write entries in order, each with criteria and a user or queue, and the first entry that matches wins. Only one lead assignment rule can be active at a time, so everything you route lives in one ordered list.
That simplicity is a real strength. An admin can read the whole policy on one screen. Web-to-lead respects it. The REST API respects it by default: the Assignment Rule header defaults to true for leads and cases, so an integration that creates leads gets routed unless it opts out. No code, no deploy, no tests.
If your routing sounds like “Texas leads go to the Texas queue, enterprise leads go to the enterprise queue, everything else goes to inbound,” assignment rules are the right answer. Stop reading and go build the list.
Where assignment rules run out
The table cracks the moment routing needs to remember something or compare people. A rule entry can check the lead. It cannot check the reps.
- No fairness. There is no native “next person in line.” Round-robin built on a formula and a counter works until someone goes on vacation, which we covered in the round-robin lead assignment build.
- No capacity. A rule cannot say “skip anyone holding more than 40 open leads.”
- No lookups to other records. Routing to the owner of a matching account, or to whoever owns the territory in a custom object, is outside what an entry can express.
- No explanation. The lead ends up with an owner and no record of which entry put it there.
None of this is a bug. A lookup table is not supposed to hold state. But when your policy has exceptions, the ordered list turns into hundreds of entries that only one person understands. That is the point where teams reach for Flow.
What Flow adds, and the catch nobody mentions
Flow can do what a rule entry cannot: query other records, count a rep’s open leads, read a roster, branch on anything. For a lot of orgs, a record-triggered flow that looks up the matching account owner and sets OwnerId is a perfectly good router.
The catch is timing. In Salesforce’s order of execution, before-save flows run before assignment rules, and after-save record-triggered flows run after them. So a before-save flow that sets the owner can be overwritten by the active rule. An after-save flow that sets the owner silently overrides whatever the rule just did. Both run, both “work,” and the lead owner depends on which one ran last.
There is a second catch. Flow has no standard element that runs your assignment rules when it creates or updates a lead. The common workaround is a small invocable Apex action that applies the rule, as Automation Champion walks through. In other words, the moment you want Flow and assignment rules to cooperate, you are already writing Apex.
Where Apex earns its place
Apex is the right router when routing is a real algorithm rather than a lookup: least-recently-assigned with capacity limits, PTO-aware rosters, a burst of 200 leads from one import that must not all land on the same rep, or a reroute that has to happen in bulk on demand.
What code gives you that the other two do not:
- Bulk safety. One import, one decision per lead, no double assignment when records arrive together.
- Real error handling. When nobody is eligible, the code decides what happens instead of falling to the default owner.
- Tests. You can prove the router does what the policy says before it touches live leads.
- A reason on every lead. The code can write which rule fired and why, so “why did Dana get this?” has an answer.
The cost has always been that Apex needs a developer, a sandbox, tests and a deploy. That is the real reason most orgs stretch Flow past where it is comfortable. We made the same argument in Flow vs Apex: the choice should be about the shape of the problem, not about who you can afford to staff.
Side by side
| Assignment rules | Flow | Apex | |
|---|---|---|---|
| Best for | Static criteria to user or queue | Routing that needs lookups and branches | Fairness, capacity, bulk, state |
| Who maintains it | Admin, in Setup | Admin, in Flow Builder | Developer, or an AI that can deploy |
| Remembers past assignments | No | Only if you build storage | Yes |
| Handles bulk imports cleanly | Yes, per record | Depends on design | Yes, if written for bulk |
| Explains the decision | No | If you add it | Yes, if you add it |
| Tests required | No | No | Yes, on deploy |
Read the table by your hardest rule, not your easiest one. If even one routing rule needs fairness or capacity, the whole decision belongs in the column that can handle it.
One owner for the owner field
Here is the setup that holds up in practice:
- Decide who owns OwnerId. Exactly one mechanism sets it on new leads. Everything else is forbidden from touching it.
- Use Flow for preparation. Normalize state codes, enrich the company size, flag the lead source. Clean inputs make any router simpler.
- Let the router decide once. Rules if it is a table, Apex if it is an algorithm. Flow as the router only when routing is lookups without fairness.
- React after. Notifications, tasks and SLAs hang off the final owner, in an after-save flow that reads OwnerId but never writes it.
A lot of “routing is broken” complaints are not bad rules at all. They are two reasonable rules fighting over the same field. If your org also merges duplicates at conversion, the same principle applies there, which is why lead conversion duplicates gets worse when routing is ambiguous.
Which one should you pick?
Ask three questions about your routing policy, in this order:
- Can you write it as a list of “if this, then that queue”? Use assignment rules.
- Does it need to look at other records, but not at who got the last lead? A record-triggered flow is fine, as long as you deactivate or narrow the assignment rule so the two do not compete.
- Does it need fairness, capacity, bulk safety, or a reason on the record? Build it in Apex.
The third answer used to end the conversation for teams without a developer. That is what changed. With an AI that can develop against your org, the Apex router stops being a three-week project. You describe the policy in plain language, the AI writes the class and its tests, and the deploy goes to a sandbox first with every change logged and a snapshot taken before it ships, so a bad routing week is recoverable rather than permanent.
For the full build of a policy-shaped router, see Salesforce lead routing automation, and if your routing is really territory logic in disguise, the territory assignment post covers that version.
The takeaway
Assignment rules are a table, Flow is a builder, Apex is an engine. Each is the right router for one shape of policy. Pick the one that fits your hardest rule, give it sole ownership of the lead owner, and let everything else prepare or react. Routing you can explain is routing you can trust.
If you want to watch your AI build the router your rules actually describe, we will show you on a short call. Pricing is flat per Sentinel and is covered on that demo call.
KEEP READING
Salesforce Flow vs Apex: When Flow Stops Being Enough
Salesforce Flow vs Apex isn't a staffing question, it's a shape question. Five signals your automation has outgrown Flow — and what to do about it.
AppExchange vs Custom Build: When to Buy, When to Build
AppExchange vs custom build: what a managed package really locks down, what it costs to leave, and the honest test for which one your org needs.
See Sentinel Workspace build in your own CRM on a short demo call.
Book a Demo Call