How to Use Lookup Field with Filter in Salesforce

In this Salesforce tutorial, we will learn how to use the lookup field with a filter in Salesforce. The Lookup field can use the filter to examine closed particular data to show on the picklist or the data that is present on the lookup filter is based on the value of the another field or it is the combination of both the objects.

The lookup field is a field that can create a relationship that connects one object to another object and the lookup filter permit the users to connect the two records in a relationship together.

While working as a Sales employee in the Salesforce company that is based in the United State Of America. I got a task where I needed to use the lookup field with a filter in Salesforce.

To fulfill this requirement, I use the lookup field on the object that is present under the object manager, and after creating the object with the lookup field we use the filter criteria for this object that connect the two records in a relationship together.

So, after looking at many solutions, I found the best solution for using the lookup field with a filter in Salesforce.

Let’s learn how to change the values displayed in the lookup field in Salesforce Lightning and Salesforce Classic.

How to use the lookup field with filter in Salesforce Lightning

Here we are using the lookup field with a filter in Salesforce Lightning. For example, we create a lookup field on the account object to assign the account number for the client. Here we not only want to relate the account number but we also want to relate to the account illustrative working with a client.

In simple words, we use the account object that is the one side and the account number is on the many sides wherever we create a record of the account number we need to relate it to the object of the account record using that lookup search icon that is available on the Salesforce lightning a classic version.

If you want to learn how to change the values of the display in the lookup field in salesforce lightning, follow these steps:

Step-1: Here we are login into our Salesforce account, now, move to the gear icon. Click on the gear icon, and under this gear icon, there are two options. The first one is Setup, and another one is Service Setup.

Click on the Setup option. After clicking on the setup option, the Setup page is open. Here we can see the object manager option at the nav bar. Click on the object manager option.

How to use the lookup field with filter in Salesforce

Step-2: After clicking on the object manager option, the object manager page is open. Here we can see lots of objects are present. Here we want to select the account object for this, we enter the account object in the search box, and the account object comes at the top.

But the account object is already present at the top of the object manager page. Click on the book object.

How to use the lookup field with filter in Salesforce Lightning

Step-3: After clicking on the account object, the book page is open. Here we can see the details on the left side of the page. Under this details section there is lots of detail is present.

Here we want to select the field and relationship option. Click on the fields and relationship option.

See also  Salesforce Encrypted Field
Use the lookup field with filter in Salesforce

Step-4: The field and relationship page is open after clicking on the field and relationship. Here we can see that many fields are present, and now we want to create one more field under this account field and relationship.

For creating a new field and relationship. Here is the new button, by simply clicking on the new button our new field is created. So click on the new button.

Use the lookup field with filter in Salesforce Lightning

Step-5: The new custom field page is open after clicking on the new button. Here we can see that many data types are present, which can specify the information the custom field will contain. Here we are selecting the lookup relationship field. Click on the next button.

Use the lookup field with filter in Salesforce Lightning

Step-6: After choosing the field type the account’s new relationship page is open. Here we can choose the related option and select the other object to which this object is related. Here we are selecting the Account object, which is work as a lookup relationship, and then click on the next button.

Salesforce Lightning use the lookup field with filter

Step-7: After clicking the next button, enter the label and name for the lookup field. First, fill the field label as Account Number and then fill the field Name. The field name is automatically fielded by simply clicking on the field. Click on the next button at the top and the bottom of the new relationship page.

How to use lookup field with filter in Salesforce

Step-8: Now scroll to the bottom of the page there is a lookup filter option. Click on the Show the filter setting.

After clicking on the show filter setting option the settings will be open now fill the filter criteria here we find the field as Account: Account Number and select the operator after that click on the filter type. There are two filter types required and optional.

Here we are selecting the required option. The required option is used where the user can enter the value that must match the criteria. If it does not display this error message on save.

The optional field type is used where the user can remove the filter or enter the values that don’t match the criteria and after that click on the checkbox to enable this filter and click on the next option.

How to use lookup field with filter in Salesforce Lightning

Step-9: We move to our next step after lookup the filter, establishing field-level security for the reference field. Select the profiles we want to grant edit access to this field via field-level security. The field will be hidden from all profiles if we do not add to it field-level security. 

Click on the visible checkbox of the field-level security for the profile and then click on the next button, which is present near the previous option.

Use lookup field with filter in Salesforce

Step-10: After establishing the field level security and the next button, we can now add the reference field to the page layout. Select the page layouts that should include this field. The field will be added as the last field in the field two-column section of these page layouts.

This field will not appear on any pages if you do not select a layout. To change the location of this field on the page, we will need to customize the page layout. Click on the next button.

Use lookup field with filter in Salesforce Lightning

Step-11: We can add the custom-related list to the page layout after adding the reference field to the page layouts. Select the title that the related list will have in all of the layouts associated with the parent and the related list label as accounts. Select the page layout that should include this field.

See also  How to Set Length and Decimal Place for the Number field in Salesforce

This field will be added as the last field in the first two-column section of this page layout. The field will not appear on any pages if we do not select a layout. To change the location of the field on the page. Click on the save button.

Salesforce use lookup field with filter

This way, we understand how to use the lookup field with a filter in Salesforce Lightning’s lookup field. Let’s Proceed and learn how to use the lookup field with filter in Salesforce Classic.

How to use the lookup field with filter in Salesforce Classic

Here we are using the lookup field with a filter in Salesforce Classic. Here we are taking an example. We use the Order object that is on the child side and the product is on the parent side wherever we create a record of the product we need to relate it to the object of the order record using that lookup search icon.

If you want to learn how to use the lookup field with a filter in salesforce classic, follow these steps:

Step-1: First, login into the Salesforce account, when we login the Salesforce Lightning account is open for moving to the Salesforce Classic. Click on the Profile picture, and under this profile picture, there is an option to switch to salesforce classic.

Click on the switch to the Salesforce classic option. We are moving to the Salesforce Classic version.

Here we click on the username drop-down arrow, and the drop-down list is open under this drop-down arrow. Under this List, there is a setup option here, we are clicking on the setup option.

How to use the lookup field with filter in Salesforce Classic

Step-2: After clicking on the setup option, the setup page is open. Under this setup page, there is App Setup, and under this App Setup, there is Customize option. Click on the drop-down arrow of the customize option.

After clicking on the Customize drop-down arrow, the drop-down list is open. Under this customize drop-down list there is an orders object option. Click on the drop-down arrow of the order object. The drop-down list is open, under this list there is a fields option. Click on the fields option.

Use the lookup field with filter in Salesforce Classic

Step-3: After clicking on the Order object, the Order custom object page is open. Now scroll to the bottom of the page and see the custom field and relationships section here. And we want to create a new custom field related to order by simply clicking on the new button.

Salesforce Classic use the lookup field with filter

Step-4: After clicking the new button, the new custom field page is open. Here we can choose the field type by specifying the type of information that the custom field will contain. Here we are selecting the lookup relationship field. Click on the next button.

How to use lookup field with filter in Salesforce Classic

Step-5: After clicking on the lookup relationship field type. The Order Relationship page is open. Here we can choose the related object, by simply selecting the other object to which this object is related. Here we select the order related to the object and click the next button.

Use lookup field with filter in Salesforce Classic

Step-6: After clicking the next button, enter the label and name for the lookup field. First, fill the field label as Product and then fill the field Name. The field name is automatically fielded by simply clicking on the field.

See also  How to display global picklist values alphabetically in Salesforce
Salesforce classic use lookup field with filter

Step-7: Now scroll to the bottom of the page there is a lookup filter option. Click on the Show the Filter setting. After clicking on the show filter setting option the settings will be open now fill the filter criteria here we find the field Order: Opportunity: Total Product and select the operator after that click on the filter type. There are two filter types required and optional.

Here we are selecting the required option. The required option is used where the user can enter the value that must match the criteria. If it does not display this error message on save. Click on the Next button.

How to use a lookup field with filter in Salesforce Classic

Step-8: After lookup, the filter criteria, now establish field-level security for the reference field. Select the profiles we want to grant edit access to this field via field-level security. 

The field will be hidden from all profiles if we do not add to it field-level security. Click on the visible checkbox of the field-level security for the profile and then click on the next button, which is present near the previous option.

Use a lookup field with filter in Salesforce Classic

Step-9: Here we can add the reference field to the page layout and select the page layouts that should include this field. The field will be added as the last field in the field two-column section of these page layouts. This field will not appear on any pages if you do not select a layout.

To change the location of this field on the page, we will need to customize the page layout. Click on the next button

Salesforce Classic use a lookup field with filter

Step-10: Here we can add the custom related lists and specify the title that the related list will have in all of the layouts associated with the parent. After that select the page layout that should involve this field.

The field will be added as the last field in the first two-column section of these page layouts and the field will not appear on any pages if you do not select a layout. Click on the Save button.

How to use an lookup field with filter in Salesforce Classic

So, with this, we have learned, how to use the lookup field with a filter in Salesforce Classic.

Conclusion:

The Lookup field and lookup filter both permit the user to create the relationship that connects one object to another object and it also connects the two records in a relationship together.

I hope this blog is helpful for you and also helps in learning how to use the lookup field with a filter in Salesforce. This lookup field creates the relation between the two objects. And I have also explained all the steps of the lookup field with filter in Salesforce Lightning and Salesforce Classic.

You may like to read: