Lookup filters are admin-defined rules attached to a Lookup or Master-Detail field that restrict which parent records the user can select in the lookup picker. They prevent users from picking inappropriate parents (wrong status, wrong record type, wrong region) at the moment of entry, which is far better than catching it later with a validation rule.
What a lookup filter does
When a user clicks the lookup magnifying glass on a field, instead of seeing every record of the target object, they only see records that match the filter criteria. The criteria can compare:
- A field on the target (parent) record to a constant:
Account.Status = 'Active' - A field on the target to a field on the current (source/child) record:
Account.OwnerId = $User.Id(only Accounts you own) - A field on the target to a value from the running user:
Account.Region__c = $User.Region__c
Required vs Optional filters
You can configure a lookup filter as one of two enforcement modes:
Required (hard filter)
- The user cannot save a record where the lookup value doesn’t match the criteria.
- The picker only shows matching records.
- Even setting the field via integration, flow, or Apex must respect the criteria — saves are blocked otherwise.
- Use when the constraint is a business rule you need enforced everywhere.
Optional (soft filter)
- The picker shows matching records by default but has a “Show all results” link.
- Users can pick a non-matching record if they intentionally want to.
- Apex / integrations save without restriction.
- Use as a “default view” or recommendation rather than a hard rule.
Examples
1. Opportunity → Contact (must be associated with the Opportunity’s Account)
On Opportunity.ContactRoleContactId-style scenarios (or any custom Contact lookup), set:
Contact.AccountId = Opportunity.AccountId
Now when a user picks a Contact from an Opportunity, they only see Contacts of that Account. Hugely reduces data-entry mistakes.
2. Case → Account (only Active Accounts)
Account.Status__c = 'Active'
Prevents users from creating Cases on accounts you’ve archived.
3. Custom Lookup with user-context filtering
On a custom Project_Manager__c lookup to User:
User.IsActive = true
User.Profile.Name = 'Project Manager'
Only active users with the PM profile can be selected.
4. Filter by running user’s region
Vendor__c.Region__c = $User.Region__c
Sales reps in EMEA only see EMEA vendors.
Where lookup filters apply
Lookup filters apply in:
- The Lightning / Classic UI lookup picker
- Inline edit in list views
- Flow screen components that include the lookup
- Apex saves (only for required filters — optional filters are UI-only)
They do not apply during:
- Direct SOQL queries from custom code
- Reports that join via the relationship
- API calls where you set the field value directly (with optional filters)
- Workflow / process / flow assignments (required filters still validate on save)
Lookup filters vs Validation rules
| Lookup Filter | Validation Rule | |
|---|---|---|
| When it fires | At picker open + at save | At save only |
| User sees | Filtered picker UI | Error message at save |
| UX | Helps user pick right | Tells user they were wrong |
| Coverage | UI + (for required) save | All save paths |
| Cross-record references | Yes, parent fields | Yes, formula references |
Best practice: use both for critical constraints — a lookup filter for great UX, a validation rule for belt-and-suspenders defense in depth.
Limits
- Up to 5 filter criteria per lookup field
- The filter must be deterministic — no random functions, no formulas that change per session
- Some field types can’t be used in criteria (e.g., long text, encrypted text)
- The filter is evaluated at picker open, so it should reference fields that are indexed when possible — otherwise performance suffers for large parent objects
Polymorphic lookups (Task.WhoId, Task.WhatId)
For polymorphic lookups that can reference multiple object types, you can set lookup filters per related object — e.g., set a filter that only applies when WhoId points to Contact.
Practical advice
Lookup filters are one of the most underused governance tools in Salesforce. If you find yourself writing validation rules saying “the lookup field’s Account must be the same as this record’s Account” — that’s a lookup filter, not a validation rule. Lookup filters surface the constraint to users before they hit save, which is a much better UX.
When designing a new lookup, ask: “What’s a record I would never want this to point to?” The answer is a lookup filter.
Verified against: Salesforce Help — Lookup Filters. Last reviewed 2026-05-17.