An assignment rule that looks right on screen can still send leads to the wrong place. Test it with real records before anyone depends on it. Do it in a sandbox, not in production.
Run the rule on a test lead
- Create a lead in the sandbox with values that should match one entry.
- On the lead edit page, tick the option to assign using the active assignment rule, then save.
- Read the owner. It should be the owner of the entry you aimed at.
To do this for many leads, use Apex. The line that tells Salesforce to run the rule is below.
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
Database.insert(testLeads, dmo);
What to test
- One lead per entry, to prove each entry can match.
- A lead that matches two entries. The first in order should win. See entry order.
- A lead that matches none. It should reach the default owner.
- A lead with a blank value in each field the rule tests.
- A lead created the way your forms create it. See web-to-lead.
What the test will not show
A flow can change the owner after the rule runs. A test that reads the owner at once will miss it. Read the owner again a minute later. See a flow overriding the rule.
Clean up
Delete the test leads. Then export the configuration and check it for entries that can never match. See how to export it.
Writing a new entry? Check it before you save it.
A test plan to copy
The values below are made up. Swap in the values your own entries test.
| Test lead | Values | Expected owner |
|---|---|---|
| Aimed at entry 1 | Country France, source Web | The owner of entry 1 |
| Matches two entries | Values from entry 1 and entry 3 | The owner of entry 1 |
| Matches none | A country no entry names | The default owner |
| Blank country | No country value | The default owner, or a named entry |
Entries that overlap are covered in entry order.
Record the result
- Write the owner you got beside the owner you expected.
- Read the owner again after a minute, in case a flow changed it.
- For each mismatch, open the entry and read its criteria again.
- Fix one entry, then rerun that test lead before the next.
Keep the table with your change notes. The audit checklist asks for the rule as it was before and after a change.
The free scan checks your export for:
- the assignment rule
- flow defects a test can miss
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.
Or check it now. The free scan reads your Salesforce export in your browser. Nothing is uploaded.