How to Make Lookup Relationship Field Filter Type Required in Salesforce

In the Salesforce lookup field, you can use the filter to examine the particular data to display on the picklist that is present on the lookup filter based on the other field’s value. Under this lookup filter section, there is a field type required checkbox present.

To make the lookup relationship field filter type required, enable the required checkbox. In this Salesforce tutorial, we will learn how to make the lookup relationship field filter type required in Salesforce.

You have come to the right place to learn this process. We learned this topic in both the editions of Salesforce Lightning and Salesforce Classic. So, let us show some examples.

How to make the lookup relationship field filter type required in Salesforce Lightning

Here we will learn how to make the lookup relationship field filter type required in Salesforce Lightning.

Let us take a real-life example, suppose there is a company that is based in California and I am working in this company and use the salesforce application that controls the project and their associated task.

Here, we have two custom object projects and tasks. Every task is related to the particular project throughout a lookup relationship field called project on task object. Here, the company wants to make sure that when the user is creating or editing the task, every task is related to the project.

Here, we add the lookup filter in the task object and make this lookup filter required by simply clicking on the required checkbox.

Here are the following steps:

1. Login into the Salesforce account –> Click on the gear icon –> Go to Setup –> Click on the object manager tab –> Select task object.

How to make the lookup relationship field filter type required in Salesforce

2. Select the Field and relationship –> Select the field type –> Lookup Relationship Field.

How to make the lookup relationship field filter type required in Salesforce Lightning

3. Now choose the related object. Here, we select the related object as a project and then click on the next button.

Make the lookup relationship field filter type required in Salesforce

4. Here, fill the field label, which we are filling as Project, and then fill the field name, which is automatically filled by simply clicking on the field name field.

Make the lookup relationship field filter type required in Salesforce Lightning

5. Scroll to the bottom of the page –> Look at the filter section –> Add the filter criteria –> Set the criteria as Project: Status is equal to Task Completed –> Click on the required checkbox.

See also  How to Make Percentage Field Required in Salesforce

This required checkbox shows the user-entered value must match the filter criteria. If we want this field option, then uncheck the required checkbox or check the optional checkbox.

Salesforce make the lookup relationship field filter type required

6. Now we move to our next step which is to establish field-level security that can select the profiles to which we want to grant edit access to this field via field-level security. Click on the next button.

Salesforce Lightning make the lookup relationship field filter type required

7. Now, add this field to the page layout. Select the page layouts that should involve this field. Click on the next button.

How to make lookup relationship field filter type required in Salesforce

8. Click on the App Launcher –> Enter the sales –> Select the object –> Click on the project object.

Under this page, we can see the three records are created and this project shows the status as project started, project developed, and project completed.

How to make lookup relationship field filter type required in Salesforce Lightning

9. Here, we want to create a new record, so that is why we click on the new record.The new task page is open. Fill the Complete information

10. Here we can see only the salesforce project is shown under the project list because this salesforce project record has the status as a project completed. This is because we choose the filter criteria project status equal to the project completed and this field is required field.

Make lookup relationship field filter type required in Salesforce Lightning

In this way, we understand how to make the lookup relationship field filter type is required in Salesforce Lightning. Let’s Proceed further and learn how to make the lookup relationship field filter type required in Salesforce Classic.

How to make the lookup relationship field filter type required in Salesforce Classic

Here, we will learn how to make the lookup relationship field filter type required in Salesforce Classic.

Let us take a real-life example; suppose there is a university that is based in California, and I am working in this university in the administrator department. All the department members are using the Salesforce application for the university student management system.

In this system, we have two objects student and course. The student object represents each student that can be enrolled in multiple courses. This is represented by a lookup relationship field that is a course on the student object.

See also  Salesforce Add Address Field to Custom Object

The university wants to make sure that when administrators add the student record they must add each student with at least one course.

On the student object, they apply filter criteria that if the student status is active then only the student record is shown under the course lookup field and this filter field is the required field.

Here are the following steps:

1. Login to Salesforce account –> Go to Profile Picture –> Click on switch to Salesforce Classic version –> Select the setup

Enter the object in Quick Find Box –> Select object option –> Select the course object.

How to make the lookup relationship field filter type required in Salesforce Classic

2. Scroll to the bottom, there is a custom fields and relationships section present. We want to create a new field, so for this, we click on the new button.

Now select the field type. Here, we select the lookup data type. After that, Click on the next button.

Make the lookup relationship field filter type required in Salesforce Classic

3. Here, we can select the other object to which this object is related, and here, we select the related object as a student and then click on the next button.

Salesforce Classic make the lookup relationship field filter type required

4. Now fill the field label, we are filling the field label as Student and then fill the field name, which is automatically fielded by simply clicking on the field name field.

How to make lookup relationship field filter type required in Salesforce Classic

5. Scroll to the bottom of the page; we can see that there is a lookup filter section.

Add the filter criteria –> select the criteria as Student: Status is equal to Active –> click on the required checkbox.

6. This required checkbox shows the user-entered value must match the filter criteria. If you do not check this required checkbox, choose this optional checkbox.

The user can remove the filter or enter any value that does not match the criteria, Click on the next button.

Make lookup relationship field filter type required in Salesforce Classic

7. Now, our next step is to establish field-level security that can select the profiles to which we want to grant edit access to this field via field-level security. Click on the next button.

Salesforce Classic make lookup relationship field filter type required

8. Now, add this field to the page layout. Select the page layouts that should involve this field. To change the location of this field on the page, we will need to customize the page layout and then click on the next button.

How to make a lookup relationship field filter type required in Salesforce Classic

9. Now specify the title that the related list will have in all of the layouts associated with the parent. Here, the related list label is courses. Select the page layouts that should include this field. Click on the save button.

See also  Salesforce Workflow Rule Not Firing
Make a lookup relationship field filter type required in Salesforce Classic

10. Click on the home tab –> select the student object.

Our student record page is open, and under this page, three student records are present, and the student status shown is active and inactive.

Salesforce Classic make a lookup relationship field filter type required

11. Select the course object. Here, we want to create a new record. So, we click on the new record. The new course page is open. Now fill the information related to the course.

Fill in the course name –> select the student –> and click on the lookup icon.

Under this lookup dialogue box, we can see only two students are shown because we added the filter criteria that student status is equal to active. So that is why it only shows the active student and this field is required.

So, with this, we understand how to make the lookup relationship field filter type required in Salesforce Classic.

Conclusion:

I hope you read the complete article and get the complete idea related to how to make the lookup relationship field filter type required in Salesforce. 

I have also explained all the steps for making the lookup relationship field filter type required in Salesforce Lightning and Salesforce Classic.

You may like to read: