
Hello, do you want to know about “How to create Salesforce Object Relationships?”. In this post we will discuss about Salesforce Object Relationships | Master-Detail, Lookup, Types of Salesforce Object Relationships, Master-Detail Relationship in Salesforce, Lookup Relationship in Salesforce, Many to Many Relationship in Salesforce, What is Junction Object in Salesforce, salesforce object relationships diagram.
Salesforce Object Relationships | Master-Detail, Lookup
Salesforce Object Relationship: In this Salesforce Tutorial we are going to learn about various Salesforce Object Relationships like Master-Detail relationships and Lookup Relationships. In our previous Salesforce tutorial, we learned about the different Salesforce field types. In this lecture, we are going to create the master-detail relationships and lookup relationships between different objects.
What is Salesforce Object relationships?
Salesforce Object Relationship is nothing but a two-way association between two objects. One object record information is linked to another object record. In Salesforce.com, object relationships are created between two objects. Here a custom field of one object record contains a link to another object record. For creating many custom objects in Salesforce.com, relationships play a major role.
In Salesforce.com, relationships are used to get data from other object records. Here the parent id is stored in a pre-defined relation.

Types of Salesforce Object Relationships
Salesforce object relationships can be divided into two types. they are
One to Many (1:M): A parent record is associated with many child records. Basically, it builds the parent-child relationship. A parent object can contain multiple child objects but a child object should have only one parent object.
- Master-Detail Relationship:-
- Lookup Relationship.
Many to Many (M:M)
Master-Detail Relationship in Salesforce
- The master-detail relationship is a type of relationship that creates a tight binding relationship between the parent object and the child object.
- Child records must always be linked to the parent, they cannot remain orphaned.
- Cascade record deletion. When a parent object record is deleted, all its child records are automatically deleted.
- Standard objects cannot be detailed objects (child objects). Example: Account details cannot be an object.
- The master-detail relationship fields are required on the page layout of the detail object.
- Roll-up summary fields can be created on the master object (parent object).
- The child record inherits all security and sharing settings from its parent record.
Lookup Relationship in Salesforce
- Lookup relation is a type of relationship that creates a loose binding relationship between a parent object and child object.
- The child record in the lookup does not need to be associated with the parent.
- No cascade record deletion occurs.
- The lookup field is not required on the page layout of the detail object.
- A rollup summary field could not be created in the lookup relationship.
- Does not inherit any setting from its parent record.
Many to Many Relationships in Salesforce
One record of one object is linked to several records of another object and vice versa. In Salesforce.com, we create a many-to-many relationship by creating two master-detail relationships with a common Junction object.
What is Junction Object in Salesforce?
In Salesforce, the Junction object is the custom object used to link a single instance of a record to multiple child records and multiple child records to the same record.
Example:- The relationship between a company and a customer is a many-to-many relationship because a company can sell a product to many customers and a customer can buy a product from multiple companies.
Conclusion
Here we clearly understood the different Salesforce object relationships. In our upcoming Salesforce tutorials, we’ll learn how to view relationship fields, master-detail relationships, and many-to-many relationships in Salesforce.