How to Make Lookup Relationship Field Required in Salesforce

In Salesforce the lookup relationship field is used to create a link between two objects, where one object holds the instance of the other object. Here we make the lookup field required to make sure that the user must populate this field with the valid value before saving the record.

In this Salesforce tutorial, we will learn how to make the lookup field relationship field required in Salesforce.

For learning this process you have come to the right place and we learned this topic in both the editions of Salesforce Lightning and Salesforce Classic.

How to make the lookup relationship field required in Salesforce Lightning

Here we will learn how to make the lookup relationship field required in Salesforce Lightning. Let us take an example, suppose there is a company that sells a product and tracks customer orders and in this company, my job is to manage the salesforce instance.

Here we have two custom objects product and order. The product object stores the information about the product of our company sells such as product name, product description, etc.

The order object represents the individual customer orders, each order involves details like order number, customer information, order date, and the specific product involved in the order.

Here in the order object, we have a lookup relationship field called the product that links each order to the particular involved in the order. This lookup relationship field permits users to relate an order with a particular product from the product object.

Here are the following steps

1. Our Salesforce lightning account is open, click on the setup option that is present under the gear icon. After that select the object manager tab that is present under the setup page on the nav bar.

2. There are lots of objects present and we want to select the order object so enter the order in the search box and then select the order object. Here we can see the details related to the object.

How to make the lookup relationship field required in Salesforce

3. We can see the Fields and Relationships option present on the left side of the page. Click on the Fields and Relationship option. On the right side, there is detail related to the object. But we want to select the field and relationship, so click on the field and relationship option.

4. After clicking on the field and relationship, the Fields and Relationships page is open. Under this page, there are lots of fields created. Here we are selecting the lookup field and here we can see the product field is a lookup field click on that field.

How to make the lookup relationship field required in Salesforce Lightning

5. Our product field page is open. Under this page, there is a detail related to the product custom field. We can edit this detail and change the detail related to the product custom Field. Click on the edit button that is present at the center of the product custom field page.

See also  How to Add Fields to a Recently Viewed List in Salesforce

6. The product fields come into edit mode and we can edit anything on this page. Scroll to the bottom of the page there is a general options section and under this section, there is a required checkbox is present.

7. Click on the checked required checkbox field, this field always requires a value in this field in order to save a record. Here we make the lookup relationship field, so that is why we click on the required checkbox and click on the save button.

Make the lookup relationship field required in Salesforce

8. After clicking on the save button we can see that our custom field amount page is open under this page we can see that the field label, field name, and API name are shown as filled.

9. Scroll to the bottom of the page and under the general options section we can see that the required checkbox is also checked and below this required checkbox there is a default value field is also present that is not filled. So this required field always requires a value in this field in order to save a record.

Make the lookup relationship field required in Salesforce Lightning

10. Click on the App Launcher, and enter the sales in the search box. The sales come at the top, click on the sales option. The Sales page is open. Under this Sales page, there are lots of objects present on the nav bar and we are selecting one of the objects.

11. Here we are selecting the order object. The order record page is opened. Under this page, we can see order record is saved. If you want to create a new record, click on the new button. The new order dialogue box is open. Here we can fill in the information related to the order.

12. Here we can see the order number is automatically generated and then fill the account name then fill in the type, and then fill in the order start date after that fill in the contract number and then fill the order type, and then fill the status, and fill in the order delivery date.

13. After that fill the order currency and then fill in the product field which is the lookup field, this lookup relationship field permits users to relate an order with a particular product from the product object.

14. This product is the required field if we leave this filled empty it shows the error. So don’t leave this field blank fill in this product field which is a required field after filling the product and clicking on the save button.

15. It does not show any error it shows your record is created and our order 0000108 record has been created the details related to the order 0000108 are shown and our product field is also shown under the detail section.

Salesforce make the lookup relationship field required

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

How to make the lookup relationship field required in Salesforce Classic

Here we will learn how to make the lookup relationship field required in Salesforce classic. Let us take a real-life example, suppose there is a company that manages its employee information using the salesforce.

See also  Salesforce Case Sensitivity For Text Field Type

For this, the company takes two objects the employee and the project. The employee objects to storing the details about each employee like the employee name department and job title.

The project object represents the project employees are assigned to work on. Every project involves details like project name, start date, end date, project manager, etc.

Here we have a lookup relationship field in the project object called assigned employee that links each project to the employee assigned to the work on that project. Now make the assigned employee lookup field required.

Here are the following steps

1. Here we want to work on the classic version, but when we click on the salesforce account our lightning version is open. So to move to the classic version, click on the profile picture, under this profile picture, there is an option, to present a switch to Salesforce Classic. Click on this to switch to the Salesforce Classic version.

2. Click on the username drop-down arrow. The drop-down list is open. Under this drop-down list, we can see that the Setup option is present. Select the Setup option. We can see on the left side of the setup option that is Quick Find box is present.

3. Enter the objects in the Quick Find box, the objects come at the top and it is present at the Create option. Click the object option.

4. The custom object page will open, and we can see the lots of objects present that are already created and from these objects, we want to select the project object. On this page, we can see the details related to the project object.

How to make the lookup relationship field required in Salesforce Classic

5. Our Project object page is open, Now scroll to the bottom of the page and here we can see the custom field section under this section, we can see lots of fields are present. From these fields, I selected the employee field and made this employee field required.

Make the lookup relationship field required in Salesforce Classic

6. The employee custom field page is open and here we can see the details related to the employee custom field, scroll to the bottom of the page we can see there is a general options section present.

7. We can see the required checkbox is present which makes our field required and the default value field present. Click on the checkbox.

8. The warning message pops up that is a warning: Potential Integration Impact that makes this field required may break the existing API or Apex requests that do not supply a value for this field after reading the message carefully click on the confirm button.

9. After clicking on the confirm button we can see our employee custom field page is again open here when we scroll to the bottom we can see under the general options we can see our required field is checked.

10. This required field always requires a value inside this field in order to save the record and then click on the save button.

See also  Manage Territories and Territory Models for Opportunities in Salesforce
Salesforce Classic make the lookup relationship field required

11. After clicking on the save button we can see our employee custom field definition detail page is open here we can see the details related to this field and when we scroll to the bottom we can see under the general options we can see our required field is checked.

How to make lookup relationship field required in Salesforce Classic

12. Go to the Home tab, and under the Home tab we can see lots of tabs are present on the nav bar here we click on the project tab, and our project object page is open. Under this page, we can see lots of project records are present. 

13. Here we want to create a new record, so we click on the new button. Our new project page is open. Now enter the information related to the project, first fill the project’s USA Name and then fill the project status and after that fill the project documentation URL.

14. After that fill the project task start time and then fill the project completion after that fill the task estimated hours and then fill the start and end date in the last we can see there is an employee field this is the lookup field fill the field by simply clicking on the lookup icon.

15. If we leave the employee field empty then the salesforce generates an error that is shown at the top of the page and under the employee field. So don’t leave this field blank fill this employee field which is a required field and click on the save button.

Make lookup relationship field required in Salesforce Classic

16. After clicking on the save button it does not show any error it shows your record is created and our sales project record is created the details related to the project are shown and our employee field is also shown under the detail section.

Salesforce Classic make lookup relationship field required

So with this, we understand how to make the lookup relationship field 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 required in Salesforce.  I have also explained all the steps of making the lookup relationship field required in Salesforce Lightning and Salesforce Classic.

You may like to read: