Skip to main content

Create Lookup Filters

Follow Along with Trail Together

Want to follow along with an expert as you work through this step? Take a look at this video, part of the Trail Together series.

(This clip starts at the 21:12 minute mark, in case you want to rewind and watch the beginning of the step again.)

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.

Introduction

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 Operator Value/Field
    User: Profile: Name
    equals 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. Lookup Filter showing Field, Operator, and Value/Field filled in for the new Lookup Relationship on the Case object.
    Field
    Operator
    Value/Field
    Contact Name: Account ID
    equals
    Field / Case: Account ID
  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.

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities