Skip to main content

Create Lookup Filters

Note

Accessibility

This unit requires some additional instructions for screen reader users. To access a detailed screen reader version of this unit, click the link below:

Open Trailhead screen reader instructions.

The Rundown

Lookup filters limit the records available in the lookup. A lookup filter can reference other fields on the same record (source); fields on the records of the lookup object (target); fields on the user's record, profile, and role; and fields on records directly related to the target object.

You’ve gotten a request from Noah Larkin, VP of Services, who would like reps to be able to capture the name of the backup rep on their cases when they are away from the office. He also wants to ensure that new cases can only be associated to contacts from the same account. To get this job done, create a lookup filter.

Create a Lookup Relationship

Create a new Backup Agent field that looks up to the User object, editable by Support Users only.

  1. From Setup, click Object Manager and select Case.
  2. Select Fields & Relationships and click New.
  3. Select Lookup Relationship as the Data Type, then click Next.
  4. Select User from the Related To picklist, then click Next.
  5. Rename the Field Label to Backup Agent.
  6. Rename the Field Name to Backup_Agent.
  7. For Description, enter: Used to identify the assigned support rep when case owner is away — for support use only.
  8. For Help Text, enter: Who is the assigned support rep when case owner is away?
  9. In the Lookup Filter section, click Show Filter Settings.
  10. Click the Find icon Lookup iconto select the Field, and fill in the filter details:
    • Field: User: Profile: Name
    • Operator: equals
    • Value/Field: Value / Support User
  11. Leave everything else as is and click Next.
  12. In the Read-Only column header, select the checkbox.
  13. In the Read-Only column, deselect the Support User checkbox.
  14. Click Next.
  15. Deselect the checkbox in front of the Close Case Layout.
  16. Click Save.

Add a filter to the case Contact Name field so that users can only select contacts related to the account selected in the case Account Name field.

  1. While still viewing the Case object, select Fields & Relationships.
  2. Select Contact Name, then click Edit.
  3. In the Lookup Filter section, click Show Filter Settings.
  4. Click the Find icon Lookup iconto select the Field, and fill in the filter details:
    • Field: Contact Name: Account ID
    • Operator: equals
    • Value/Field: Field / Case: Account ID
      Lookup Filter showing Field, Operator, and Value/Field filled in for the new Lookup Relationship on the Case object.
  5. Ensure Required is selected next to Filter Type.
  6. Leave everything else as is and click Save.

You’ve taken care of Noah’s request by creating a lookup filter. Keep making things better for the AW Computing team in the next step, where you work with custom formula fields.

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback