Salesforce Lookup Filters: Complete Guide

Quick Summary:

Lookup filters restrict which records appear in a lookup field's search results, based on criteria you define -- keeping users from accidentally selecting the wrong or inactive record.

What Is a Lookup Filter?

A lookup filter narrows the records available for selection in a lookup or master-detail field's search dialog, based on filter criteria. Without one, a lookup shows every record on the target object regardless of relevance -- a lookup filter keeps users focused on genuinely valid options.

How to Set One Up

  1. Go to the lookup field's setup page and find the Lookup Filter section.

  2. Define the filter criteria -- field values, or dynamic references to the current record or logged-in user.

  3. Choose whether the filter is required (blocks selection outside it) or optional (warns but allows override).

  4. Write a clear error/warning message explaining why certain records are filtered out.

  5. Save and test by attempting to search the lookup as an end user would.

A Real-World Example

A Case record has a lookup to Contact, but should only show Contacts belonging to the Account already selected on that Case -- not every Contact in the entire org. A dynamic lookup filter referencing the Case's own AccountId field against the Contact's AccountId narrows the search results to genuinely relevant Contacts, preventing the common mistake of accidentally linking a Case to the wrong company's contact.

💡 Pro Tip

Use optional (warning-only) filters rather than required ones when there's a legitimate, if uncommon, reason a user might need to select outside the filter -- a required filter that's occasionally wrong just frustrates users with no path forward.

Frequently Asked Questions

Can lookup filters reference fields on the current record being edited?

Yes, lookup filters can reference fields on the source record, letting you build genuinely dynamic filtering (e.g. only show Contacts belonging to the Account already selected).

Are lookup filters required or optional?

Optional -- a lookup filter can be set to required (blocking selection outside the filter) or optional (just warning, but still allowing override).

Can a lookup filter be based on the current logged-in user?

Yes, lookup filters can reference $User merge fields, letting you filter based on attributes of the person doing the selecting, not just the record itself.

Do lookup filters affect API-based record creation, or just the UI?

Lookup filters primarily affect the UI selection experience -- records created via API or Data Loader aren't blocked by lookup filters the same way manual UI selection is.

Can I use a lookup filter to prevent selecting inactive records?

Yes, this is one of the most common use cases -- filtering a lookup to only show Active = true records, keeping users from accidentally selecting deprecated or inactive related records.

What\'s the difference between a lookup filter and a validation rule?

A lookup filter narrows what's selectable in the lookup field's search dialog itself; a validation rule checks the record's state after the fact, at save time -- they serve complementary purposes.

Can lookup filters be overridden by users with certain permissions?

Optional (non-required) lookup filters show a warning but allow the user to override and select outside the filter anyway if they choose to.

Do lookup filters slow down record lookup performance?

Generally negligible impact for reasonably-scoped filters, though extremely complex filter logic on very large related object volumes could theoretically add some overhead.

Can a lookup filter reference a formula field?

Yes, as long as the formula field exists on the relevant object, it can be used as part of the lookup filter's criteria.

Is there a limit to how complex a lookup filter\'s logic can be?

Lookup filters support standard filter logic (AND/OR combinations) similar to other filter criteria throughout Salesforce, with practical limits on complexity before it becomes hard to maintain.