The assignment rule does not run on every lead. Whether it runs depends on how the lead was created. That is behind many "my rule works in the UI but not for these leads" reports.
1. The rule was not asked to run
Leads created through the API, an import or an integration often run the rule only when asked. A data import wizard has a checkbox for it. An API call needs the assignment rule header. Data Loader has an assignment rule setting. If none is set, the lead goes to its default owner. Often that is the integration user.
| Way in | How it asks for the rule |
|---|---|
| Data import wizard | A checkbox |
| Data Loader | An assignment rule setting |
| API or Apex | The rule header. In Apex, assignmentRuleHeader.useDefaultRule = true on the save options. See how to test an assignment rule for the three lines |
2. The integration sets an owner itself
If the integration writes an owner on the record, that value is used. The rule has nothing to decide.
3. A flow or trigger sets the owner afterwards
Code and flows that run on creation can overwrite whatever the rule chose.
4. The fields the rule tests are empty
An integration that does not populate country, state or source gives the rule nothing to match. The lead falls to the catch-all.
Check it yourself
SELECT COUNT() FROM Lead WHERE IsConverted = false AND CreatedBy.Name = 'Integration User'
SELECT COUNT() FROM Lead WHERE IsConverted = false AND Owner.Name = 'Integration User'
Use the name of your integration user. If the second number is high, leads are being created and then never reassigned. Compare it with the leads that arrived through the form, which usually run the rule.
Leads from an ad platform arrive this way. See LinkedIn Lead Gen Form leads.
Related: web-to-Lead leads not assigned in Salesforce and leads still owned by the integration user in Salesforce.
The free scan cannot count leads created through the API. It checks the setup behind it.
Have it checked every night instead.
Routing Forensics connects as a read-only user and checks this, and the rest of your routing, against your real leads. Three design partners get a free health report on their own CRM, free for 90 days: what is leaking, where, and what it is worth. Apply for a place.
The free scan cannot count leads created through the API. It reads your routing setup in your browser. Scan your Salesforce or HubSpot routing. The nightly check, open to design partners, counts it.