Creating A Master Detail Relationship In SalesForce

Salesforce is a cloud-based online solution for customer relationship management (CRM). Salesforce provides all the departments - like marketing, sales, commerce, and service - with a shared view of our customers in a single integrated CRM platform.

 

Relationships in Salesforce

 
A relationship is a two-way association between two objects. We create relationships to link objects with each other so that when the users view records, they can also see related data. Avoiding data redundancy and data inconsistency, we are in need of relationship. We can define different types of relationships like Master-Detail Relationship, Lookup relationship and Many to Many Relationship.
 
Master-Detail Relationship
 
A master-detail relationship is a parent-child relationship where the master is like a parent and detail is like a child in which master object controls some behaviors of the detail object. Also, when a Master object record is deleted, the detail object related to it also gets deleted.
 
Lookup relationship
 
Lookup Relationship is nothing but creating a relationship between two same objects. This Lookup Relationship is a Self-relationship to the same object.
 
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 this article, we will learn how to create a Master-Detail Relationship between student and department objects in SalesForce.
 
The prerequisites are for creating a Master-Detail Relationship in SalesForce are - Register a Salesforce Free Trial account using the following link.
 
Step 1
 
Log into your Salesforce account and click "Setup".
 
Creating The Master Detail Relationship In SalesForce
 
Step 2
 
Click the Object Manager and create the Department, Studentobject (custom object – Refer How to create custom object) and create the Department custom fields (DepID, DepName, DepIncharge, DMobno) and student object custom fields (StudID, SName, SMobno, SEmail)(Refer How to create custom Field).
 
Creating The Master Detail Relationship In SalesForce
 
Creating The Master Detail Relationship In SalesForce
 
Step 3
 
After creating the Student and Department objects, now we can create Master-Detail Relationship between Department and Student objects.
 
Select a Student object, Select the Field & Relationships in the details tab and click New.
 
Creating The Master Detail Relationship In SalesForce
 
Select the Master-Detail Relationship and click Next.
 
Creating The Master Detail Relationship In SalesForce
 
Select the related to object as Department and click Next.
 
Creating The Master Detail Relationship In SalesForce
 
Enter the Field Label and Name for the lookup and click Next.
 
Creating The Master Detail Relationship In SalesForce
 
Visible all the field level security and click Next.
 
Creating The Master Detail Relationship In SalesForce
 
Now, the Master-Detail Relationship is created between the Department and Student objects.
 
Creating The Master Detail Relationship In SalesForce
 
Step 6
 
Now, we can verify the Master-Detail Relationship between Department and Student objects through App Launcher.
 
Select the New Department from Departments tab.
 
Creating The Master Detail Relationship In SalesForce
 
Enter the Department details and click Save.
 
Creating The Master Detail Relationship In SalesForce
 
One more Department was created with the new Department is also added and the list of added Departments is mentioned below.
 
Creating The Master Detail Relationship In SalesForce
 
Select "New Student" from Students tab,
 
Creating The Master Detail Relationship In SalesForce
 
Enter the Student details and select the studdep (master-detail relationship) as the list from Department object and click Save,
 
Creating The Master Detail Relationship In SalesForce
Creating The Master Detail Relationship In SalesForce
 
One more student is also created and the added students list is,
 
Creating The Master Detail Relationship In SalesForce
 

Summary

 
Now, you have successfully created and tested the Master-Detail Relationship between Department and Student objects in SalesForce environment.


Similar Articles