Apr 29, 2019 | 0 Comment | Posted by Shrey Sharma

Lookup Relationship

Lookup Relationship in Salesforce links two objects together but has no effect on deletion or security. Unlike master-detail fields, lookup fields are not automatically required.

When a salesforce lookup relationship is defined, data from one object can appear as a custom related list on page layouts for the other object. There are derived into 2 subtypes:

Hierarchical:

A special lookup relationship is available for only the user object. It lets users use a lookup field to associate one user with another that does not directly or indirectly refer to itself.

For example: You can create a custom hierarchical relationship field to store each user’s direct manager.

Self:

When an object has a lookup with itself, it is a self-relationship.

Many-to-Many:

Many-to-Many relationships can be modeled using master-details relationships between any two objects. It allows each record of one object to be linked to multiple records from another object and vice versa.
To create a many-to-many relationship, simply create a custom junction object with two master-detail relationship fields, each linking to the objects needed to relate.

Primary Relationship:

It is the relation created first with any of the two master objects.

  • The object with which the relationship is created first is called the primary master object.
  • The detail and edit page of the junction object will use the color and any associated icon of the primary master object.
  • The junction object records will inherit the value of the owner field.
  • The sharing and security settings of junction objects will depend on the associated master record.
  • Deleting a record of the primary object will delete the associated records of the junction object as well.

Secondary Relationship:

The second master-detail relationship created with another master object.

  • The object with which the relationship is created first is called the secondary master object.
  • This relationship does not affect the look and feel of the junction object.
  • The security and sharing setting of the junction object depends on secondary relationships as well.
  • Deleting a record of a secondary object also deletes the associated records of the junction object.

Note:
Junction objects cannot be created as a master object in a master-detail relationship with another object as detail.

Let us now learn Lookup Filter and Schema Builder.

Share This Post

Leave a Comment

Your email address will not be published. Required fields are marked *

-->