How to Create Lookup Relationship in Salesforce

I worked as a Salesforce Administrator for an organization that was hiring employees across various departments. As part of creating profiles for these new employees, we needed a way to assign them to their respective departments easily.

To do this, we wanted a field that would allow users to search for and select the appropriate department for each employee.

So that, when users open a department record, they should see a list of all new employees assigned to that department. To meet this requirement, we used a lookup field in Salesforce that provides this functionality.

Here, I will explain the lookup relationship field in Salesforce. In this section, we will explore the types of relationships available in Salesforce and demonstrate how to create a lookup relationship using an example.

Types of Relationships in Salesforce

The following are the five types of relationships in Salesforce:

  1. Lookup Relationship:
  2. Master-Detail Relationship:
  3. Self Relationship:
  4. External Lookup Relationship:
  5. Many-to-Many Relationship:

Lookup Relationship in Salesforce

In Salesforce, a lookup relationship is loosely coupled. It establishes a relationship between two Salesforce objects, allowing us to access records of other objects in the relationship.

The lookup relationship is a one-to-many (parent-child) type of relationship, and the lookup field is always created on many sides (child). In a lookup relationship, the child record does not depend on the parent record; it can exist without the parent.

Create a Lookup Relationship in Salesforce

Suppose there are two objects: a Contact object and a Custom Object named Bank Account_c. You need to relate the bank account record to the contact record so that you can add the bank account to the contact from the contact object.

Using the following steps, we can achieve the above requirement by creating a lookup relationship between the bank account and the contact object. In