Object Relationships in Salesforce.

Asked 24-Jan-2018
Viewed 308 times

1 Answer


In Salesforce relationships allow creating relationships between one object with another object. Relationships in salesforce are the bi-directional association between two objects.

Salesforce supports following types of relationships:

Master-Detail Relationship (1: n):

All the behavior of detail object is controlled by the master object as a parent-child relationship, and the related records of a master object will be deleted if the master object deletes. The detail object’s owner field is not available and the record of the associated master is automatically set to the owner. The detail side of a custom object in the master-detail relationship cannot have manual sharing/queues, sharing rules.

The detail record of its master acquires the sharing and security settings. The detail records page layout the master-detail relationship field is required. In Master-Detail relationship by default, records can’t be reparented. Administrator permits this relationship in the child records on the custom objects, which are reparented with the different parent records, from Allow “reparenting option” in the definition of master-detail relationship.

Lookup Relationship (1: n): This relationship associates two objects together without effecting deletion or security. In this relationship when we define a relationship, data of one object can appear as a custom related list on page layouts for the other object.

Many-to-Many Relationship: By using the master-detail relationships to the model many-to-many relation between objects. This relationship allows an object each and every record should be linked to the multiple records from another object and vice-versa.
For creating this relationship at first we create a simple custom junction object with two master-detail relationship fields and link the objects with each field as you want to relate.