Object Relationships in Salesforce

Different Types of Object Relationships in Salesforce

In Salesforce, we can associate one object with another object. We can create the relationship by creating a custom relationship field of an object. By creating a relationship among the objects, users can view the related data which is associated with that object. In simple words, we can say that an object relationship is an association between two or more objects together. 

Types of Relationships

There are three types of object relationships in the Salesforce mentioned below:- 


Advertisement

  1. One-to-many 
  2. Many-to-many 
  3. Self-relationship 

1. One-to-many relationship (Parent and child relationship)

In a one-to-many relationship, one object record can be associated with multiple object records. 

For E.g.: 1. One Hiring Manager can handle multiple positions at a time. 

In this relationship, the Manager is the Parent object, and the Positions associated with him are the child object. 

dont miss out iconDon't forget to check out: Relationships in Salesforce Financial Services Cloud

Further, we categorize two types of One-To-Many relationships

         i. Lookup Relationship 

         ii. Master-Detail Relationship 

i. Lookup Relationship

Lookup relationship is a loosely coupled relationship among the Salesforce objects. Loosely coupled means when we delete the parent record, there is no effect on the child records associated with it. Child records remain in the system. In this kind of relationship, parent objects and child objects have their own sharing setting and security controls.

ii. Master-Detail Relationship

Master-Detail Relationship is a strongly coupled relationship among the Salesforce objects. Strongly coupled means when we delete the parent(master) record, all the child records associated with that parent record are also deleted. In this type of relationship, the behavior of child records like visibility and sharing depends on the behavior of the parent(master) record. It means the security setting of the parent object is also applicable to the child object. 

2. Many-to-Many Relationship

A many-to-many relationship allows each record of one object to be linked to multiple records from another object and vice versa. In simple words, multiple records of one object can be associated with multiple records of another object and vice versa. 

For E.g.: 1.  Multiple job positions can be posted on multiple employment websites. And also, multiple job websites can have multiple job positions from different organizations. 

For creating a many-to-many relationship among the objects, we use a junction object to connect the two objects we want to relate to each other. 

Junction Object:- It’s a custom object with two master-detail relationships. By using this type of object, we model a many-to-many relationship between two objects. 

dont miss out iconCheck out another amazing blog by Arpit here: Product Rules in Salesforce CPQ - Learning Guide

 3. Self-Relationship

Self-relationship is a kind of lookup-relationship with the same object. Self-relationship creates a tree diagram of the objects. 

For E.g.: When we order anything from an online resource like amazon but we get a damaged or wrong product, we can raise a replacement order on the same object. 

Responses

Popular Salesforce Blogs