Lookup Relationship in Salesforce

The lookup relationship is the most simple relationship we can create between two objects in which there are no difficulties associated.

The lookup relationship field is an important topic in the Salesforce tutorial, so I decided to write a complete article on it.

In this Salesforce tutorial, I will explain the lookup relationship and how to create a Lookup Relationship in Salesforce lightning and classic interface.

What is the Lookup Relationship in Salesforce

The lookup relationship field type in Salesforce is defined as a field that can create a relationship connecting one object to another.

These fields allow users to select a value from a popup list by clicking on the lookup icon. The other object is the source of the value in the list.

Consider a scenario where there are two objects: one is the parent object, and the other is a child object if we can delete the record of the one-side object records. The records associated with it are on the many side or we can say that the child object will not get deleted.

It is also not required for every many side object record to be associated with the one side object record. This relationship is lookup.

Read How to Create Formula Field Type in Salesforce

Create a Lookup Relationship in Salesforce

Salesforce offers the ability to create a lookup relationship field in the contact manager, group, professional, enterprise, performance, unlimited, developer, and database.com editions.

You can also create a lookup relationship field in both the Salesforce Lightning and Salesforce Classic user interface. If you want to learn, then read the complete post.

How to Create a Lookup Relationship in Salesforce Lightning

Here we are creating a lookup relationship field type in Salesforce Lightning.

Consider a scenario: A student has lots of books, and these books help them in their studies. They crack their exams, which can help them apply for jobs in the future.

See also  Salesforce Time Field

There is a field that we can use as a lookup relationship to establish a relationship between the books(Child) and students(Parent). This relationship enables one to many connections between the student and the book object.

The following are the steps to create a lookup relationship field in Salesforce Lightning:

1. Click on the Gear icon –> Select the Setup option –> Click on the Object Manager tab.

Lookup Relationship in Salesforce

2. Now, enter the book in the search box and select the book custom object.

Lookup Relationship Salesforce

3. Now select the Fields and Relationships option that is present under the details section.

Create lookup relationship in Salesforce

4. For creating a new field. Click on the new button.

Create a lookup relationship type in Salesforce Lightning

5. The new custom field page opens. Here, we can see that many data types are present. Here, we are selecting the Lookup Relationship field. Click on the next button.

Lookup Relationship in Salesforce

6. Now, select the other object to which this object is related. Here, we select the USA Student object, which works as a lookup relationship, and then click on the Next button.

Lookup Relationship in Salesforce example

7. Enter the label and name for the lookup field. Fill the Field Label as USA Student and then fill the field Name. Click on the Next button.

How to create lookup relationship type Salesforce

8. 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. Click on the visible checkbox of the field-level security for the profile and then click on the next button.

How to create lookup relationship field type Salesforce Lightning

9. 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. Click on the Next button.

Create lookup relationship field type Salesforce

10. Select the title that the related list will have in all of the layouts associated with the parent and the related list label as books. Click on the Save button.

create lookup relationship type in Salesforce

11. After clicking the save button, the USA Student Lookup field is created successfully and present under the field and relationships.

Salesforce create lookup relationship field type

12. Click on the App Launcher; there is a sales option. Click on Sales. Click on the Books object. There is the USA Student field. Fill the USA Student field as Arne Nitzsche.

Salesforce Lightning create lookup relationship field type

13. Now open the Student object. Click on the USA Student object. Here, we can see that the 1002 book is related to Arne Nitzsche USA students with the help of lookup relationships.

See also  Salesforce Case Sensitivity For Text Field Type
How to create the lookup relationship type Salesforce

This way, we understand how to create the lookup relationship type in Salesforce Lightning. Let’s Proceed and learn how to create the lookup relationship field type in Salesforce Classic.

Read How to Use Lookup Field with Filter in Salesforce

How to Create a Lookup Relationship in Salesforce Classic

Here we are creating the lookup relationship field type in Salesforce Classic.

Consider a scenario: there is a school with lots of students, and all the students studying in that school take the exam after studying. After taking the exam, they get good marks and become successful people.

Now, we create the lookup relationship between the school and the students by simply using the Lookup relationship field.

Here are the following steps:

1. Log in to Salesforce Account –> Click on the username drop-down arrow –> Select the Setup option.

How to create a lookup relationship field type Salesforce

2. There is a Quick Find Box Present, enter the object in the Quick Find Box and select the objects option.

Create a lookup relationship field type in Salesforce

3. Custom Object Page is open –> Select the USA Student object that is the parent object.

Salesforce create a lookup relationship field type

4. Now scroll to the bottom of the page there is a field and relationship section present. For creating the new field Click on the new option.

How to create lookup relationship type in Salesforce

5. Now choose the field type. Here, we are selecting the Lookup Relationship field.

Create lookup relationship field type in Salesforce

6. Here, we choose the related object by simply selecting the other object to which this object is related. Here, we select the School as related to object and click the next button.

Salesforce create lookup relationship field type

7: Now, enter the label and name for the lookup field. Fill the field label, here, we are filling the field label as School and then fill the field name. Click on the Next button.

How to create the lookup relationship field type in Salesforce

8. Now, establish the field-level security for the reference field. Select the profiles we want to grant edit access to this field via field-level security. Click on the Next button.

See also  How to Set Default Value for Time Field in Salesforce
create the lookup relationship field type in Salesforce

9. 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. To do so, click on the next button.

Salesforce create the lookup relationship field type

10: Here, we can add the custom field to the page layout after establishing the field security. Select the title that the related list will have in all of the layouts associated with the parent and the related list label as books. Click on the save button.

How to create an lookup relationship field type in Salesforce

11. Now specify the title that the related list will have in all of the layouts associated with the parent. Click on the Save button.

Create an lookup relationship field type in Salesforce Classic

So, with this, we have learned how to create the lookup relationship field type in Salesforce Classic.

Conclusion

I hope now you have an idea of the Lookup Relationship field in Salesforce and how to create a Lookup Relationship field in Salesforce.

I have also explained the creation process of the lookup relationship field with different scenarios in the Salesforce interface.

You may also like: