Considerations for Lookup Filters
REQUIRED EDITIONS AND USER PERMISSIONS
Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience
Available in: All Editions except for Database.com.
USER PERMISSIONS NEEDED
To manage lookup filters:
Customize Application
On the Fields page, the icon indicates all fields with active lookup filters. The icon indicates that the lookup filter is required.
The lookup filters you create in Salesforce also appear in the partner portal and Customer Portal.
Lookup filters are case-sensitive.
If you convert a required lookup filter with a custom error message to be optional, Salesforce deletes the message.
If you create a lookup filter that invalidates an existing value for that field, the value persists. However, when a user edits the record, Salesforce displays an error message and requires the user to change the invalid value before saving.
You can’t save changes that cause required lookup filters on related records to contain invalid values.
Versions 16.0 and higher of the Salesforce API support lookup filters. Lookup filters are enforced when you load data through the API.
If you configure a lookup filter to show inactive users only, the relationship field has no valid options. Inactive users are never valid for relationship fields that point to the User object.
If you create a filtered lookup on a field that looks up to another object, both objects must be deployed into the organization at the same time.
Lookup field filters don’t work if the field criteria include a master-detail relationship field.
Salesforce doesn’t display an error message if the value of a controlling field invalidates the value of a dependent master-detail relationship field.
Dependent lookups are supported in Visualforce pages.
In Lightning Experience, a lookup filter doesn’t work if a field referenced in the filtered lookup isn't added to the page layout.
Spanning Relationships in Lookup Filters
Filter criteria can include fields directly related to the target object (one level only). For example, on a lookup field pointing to contacts, a lookup filter can reference fields on the account related to the contact via the Account Name relationship field. The lookup field can also reference fields on the contact related to the contact via the Reports To relationship field.
For required lookup filters, each field referenced on a related lookup object counts against the number of unique relationships allowed for the referenced object, not the source object. For example, the two unique relationships described above count against the number allowed for the Contact object. Optional lookup filters don't count against the limit on the number of unique relationships allowed per object.
To see which lookup filters affect the limit for a particular target object, from the management settings for the object, go to Related Lookup Filters.
Lookup Filters vs. Validation Rules
Validation rules and lookup filters achieve similar ends, but offer different advantages. Use a lookup filter if:
You want to improve user efficiency by limiting the number of available options in a lookup search dialog.
You want to improve user efficiency by automating filters on lookup search dialogs that your users manually set.
Use a validation rule if:
You're close to the maximum number of lookup filters allowed.
You must implement a complex business rule that requires you to use a formula. Formulas can reference fields that basic filter criteria can't reference, such as fields on the parent of the source object. Formulas can also use functions. For example, use ISNEW if the rule should only apply on record creation, or ISCHANGED if the rule should apply when a field changes.