How to Create a Lookup Filter on a Lookup Field in Salesforce

How to Create a Lookup Filter on a Lookup Field in Salesforce

Sometimes when creating fields on an Object in Salesforce, we want to reference data in another area, either on the same Object or a separate Object. We can achieve this with Lookup filters on a Lookup field. 

Lookup field:  as the name suggest, Lookup fields look up to another field or object to pull data down from that field.

You might be wondering when you would use a Lookup field; you see examples across even the standard out-of-the-box Salesforce Org; one example is Account Owner on Contact Object, which shows who owns the Account for the company name. This information is not repeated over every Object, and the field uses a Lookup field to the Account Object. Another example would be creating a Custom Object, and you want to pull the Account Name, so you create a Lookup field with a Lookup Filter to the Account Object. 

In today’s example, we will look up the Account Object and search for a specific Record Type on the Account Object.

Example Information

In this example, we will be working in my developer org for a fictitious music label and creating a field on the Show Object that allows us to pick the Venue where the show is being held out. In this Org, Venue is its Record Type on the Account Object. Below is a step-by-step guide on how I created this.

We first need to pull up the Object we will be working on in the Object Manager and create a new Field under the Fields & Relationships link on the Show Custom Object. To do that, I take the following path in my Salesforce Org.

  • Setup
  • Object Manager
  • Show (my Custom Object)
  • Fields & Relationships
  • New

This will pull up the New Custom Field Page

Once we are on the New Custom Field page, we will select the Data Type for the field we are creating. In this case, it is a Lookup Relationship.

New Custom Field Page Screenshot - Creating a custom lookup
New Custom Field Page

Click Next

Now we get to create our new Relationship between Objects in our Salesforce Org. For this example, we want to look at the Account Object since the information we want to grab is on the Account Object with its Record Type.

Choose the object that you want to create a relationship with
New Relationship Screen – in this example, we will choose Account

Choose: Account

Click Next

Field Details Screen

In this screen, we enter all the details about the field: label, name, description, and help text, and this is the screen we add the Filter for the field on the Record Type: Venue on Account Object.

  1. Field Label: Venue
  2. Field Name: Venue
  3. Description: What Venue is the event being held?
  4. Help Text: What is the Venue the Event is being held?
  5. Lookup Filter: Click the link to enter the filter fields

After we fill in all the information about our fields, like the label and description, we get to create the Filter. Next, click on Show Filter Settings

In this screen, we will start adding the criteria to our Filter

Add Filter criteria to our to the field input box.
Adding Filter Criteria

In the field box, click on Account: Now, we will be following the path through the Account Object to the Record Type Name like this:

Account: Account Record Type: Record Type Name

The filter path to Record Type Name
The filter path to Record Type Name

The Path is:  Account: Account Record Type: Record Type Name

The last part is filling in the Operator, choosing Value, and adding the name of our Record Type, which in this example is Venue. It should look like this when done.

Completed filter
Completed Filter

Now you need to click:

  • Next
  • Next
  • Save

Now you have created a Cross-Object Lookup Field.

Leave a Reply

Your email address will not be published. Required fields are marked *