Start tracking your progress
Trailhead Home
Trailhead Home

Create Lookup Filters

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 Backup Agent.
  6. Rename the Field Name 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 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 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.

retargeting