Guides / Lead routing / Salesforce
AI lead routing in Salesforce
AI lead routing in Salesforce means an agent enriches and scores an inbound lead, then hands a routing decision to Salesforce for assignment, with the reasoning written to the record. Salesforce handles ownership and sharing. The agent handles the judgment that assignment rules cannot express.
The reason this split matters is that Salesforce assignment rules are more limited than most teams realize, and the limits are structural rather than a matter of configuration effort.
Where Salesforce assignment rules stop
Only one assignment rule can be active per object at a time. You can define many, but exactly one is live. All routing logic has to fit inside that single rule, expressed as ordered rule entries, up to 3,000 of them. Every additional territory, product line, and segment is another entry in one increasingly long ordered list that nobody wants to touch.
Rule entries evaluate in order and stop at the first match. That makes ordering load-bearing. Inserting a rule in the wrong position silently changes the outcome for leads that used to match something further down, and nothing in the interface warns you.
Assignment rules do not fire on API inserts unless you tell them to. A lead created through the API, which is how nearly every enrichment tool, form handler, and integration creates leads, skips the active assignment rule entirely unless the request sets the assignment rule header. This is the single most common cause of leads sitting unassigned in an org that appears correctly configured. The rule works when an admin tests it in the interface and does nothing in production.
Round robin is not native. Salesforce has no built in rotation for leads. Every implementation is custom: a counter on a custom object, a Flow holding a last assigned pointer, or a managed package. Each of those has a concurrency problem when two leads arrive in the same instant, and most implementations do not handle it.
Where the agent belongs
Put the agent before the assignment decision, not inside it. The sequence that works:
- Lead arrives and is created with a routing status of pending, not with an owner.
- The agent enriches from your enrichment sources, scores against ICP, and produces a routing recommendation with a stated reason.
- The recommendation is written to fields on the lead: recommended owner, segment, score, and a short rationale.
- Deterministic code performs the actual assignment from those fields. A model never sets OwnerId directly.
- Routing status flips to routed, with a timestamp. That timestamp is what makes speed to lead measurable.
The reason the model does not set ownership directly is the same reason it should not write anything consequential directly. Assignment is a decision a person is measured on and compensated for. Keep the model on the recommendation and let plain code execute it, so the behavior is reproducible and the failure is inspectable.
The Salesforce-specific failure modes
Validation rules block agent writes silently. Validation rules fire on every save, including saves from the API and from automation. An agent writing a field that trips a validation rule gets an error the calling integration may swallow. The lead is then enriched in the agent's logs and unenriched in Salesforce. Check the org's validation rules against every field an agent will touch before the first write.
Governor limits bite in bulk. Synchronous Apex allows 100 SOQL queries and 150 DML statements per transaction. An agent integration that processes leads one at a time in a trigger context will hit these during a campaign spike, which is exactly when routing matters most. Batch the work or move it out of the transaction.
Duplicate rules interact badly with enrichment. Salesforce matching and duplicate rules run on insert. An agent that enriches a lead into a state that now matches an existing record can trigger a block or an alert after the fact. Decide up front whether enrichment happens before or after duplicate evaluation, and make it explicit rather than incidental.
Lead conversion loses the trail. Converting a lead creates Account, Contact, and Opportunity records. Custom fields carry over only if they are mapped. Routing rationale, score, and timestamps written by the agent disappear at conversion unless field mapping is configured for them, which means your speed to lead reporting breaks precisely for the leads that converted.
What to build first
Not the agent. First make routing observable: a routed timestamp, a routing reason field, and a report of leads that are unassigned or were assigned more than five minutes after creation. Most teams discover a routing problem they did not know they had, and it is usually API inserts skipping the assignment rule. Fix that before adding intelligence on top, because an agent layered over broken routing produces faster wrong answers.
The general architecture, independent of CRM, is in how to automate lead routing with AI. The controls that keep an agent safe to point at Salesforce are in guardrails for AI agents that write to your CRM, with a working implementation at crm-write-guard.
SYN.AUTON builds these systems. Salesforce Automation or tell us what you want to automate.
On the other CRM
AI lead routing in HubSpot. Same problem, different primitives and different failure modes.