A master-detail relationship defines the relationship between the parent and the child. The master table defines the parent relation and the detail defines the child relation. If the master table is deleted then the child record data is also deleted. The RUS(Roll-Up Summary) fields are also created on master records.
Want to enhance your skills in dealing with the world's best CRM, enroll in our Salesforce Online Course
Let us start with an example, create two different Objects for Master-detail relationship, and have a look at the benefits we have in MDR.
Eg: Two Objects.
I have included simple fields for “Company Names & Employees” Objects as shown in the below figure.
For MDR, we need to create a relationship field on one of the Objects. Select for strong relationship bonding not as “Lookup relationship”.
I have taken Employees Object and created an MDR field in it. The process includes,
Click on Employees >> Click “Quick Access Menu” >> Add “New Field”.
Step1: Choose Field Type (Master Detail Relationship) >> Next.
Step2: Select the appropriate Object on which the relationship should be established.(eg: Company name) >> Next.
Step3: Fill in the details and proceed to the next step.
Step4: Provide with all the required security level check and proceed to the next step.
Step5: In this step, we will add a reference field for MDR to the page layout and proceed for next step.
Step6: In this step, we will add a custom related list of the desired Object and Save.
With the above steps, the MDR relationship is established. The below displays the relationship.
Hence, we can look at the MDR created between the “Company Names and Employees”
Let us add, an New Employee to the Object. We can observe that without the “Company Name” entering, it is unable to proceed to the next step. So, click on the magnifying glass located to the field next to enter “Company name”, you can select the company name for which the employee belongs to.
Note: We can create upto 2 MDR in 1 Object. Not more than that.
To look at the MDR, Field Dependency & Cache clear process, let us assume with an example. Let us create some records in the “Employee Object”.
Let us delete the “Company Name” (eg.Tech Mahindra), from the list and observe the dependency, cascading delete & master-detail relationship work process.
After deleting the “Tech Mahindra” record from the “Company Names” Object list, the dependent employee’s and their records are also deleted from the “Employees” Object. Whereas this scenario is not possible in “Lookup Relationship”
Note: In MDR the master record i.e the owner of the primary record will become the owner the child record another feature that to be considered in the MDR, where it is not available in Lookup Relationship.
Below is the example for the primary and secondary records relations, in which the “Owner” of the “Company Object” becomes the Owner of the “Employees Object”. So, the Owner field is not visible in the assigned company employee record details.
Master Detail Fields:
Few Points About Master-detail Relationship:
A roll-up summary determines the values of the related records, whereas in a related list. We can create a roll-up summary to display values of the master record based on field values in the detailed record, and the record must be related to MDR.
Let us create a RUS field in the desired “Company” from the list and observe the process.
Click on the “Company Names Object” >> Click on the quick access menu located on the right side of the application area(Org) >> New Field.
Step 1: Select the “Roll-Up Summary” >> Proceed to the next step.
Step 2: Enter the details of the field name. (Eg. Maximum Experience) >> proceed to the next step.
Step 3: select the summarised object. (Eg. Employees) >> Select the Roll Up type. (Eg. Max) >> select the field to aggregate. (Eg. Experience) >> Filter Criteria (Eg. All records) >> Proceed to next step.
Note: In filter criteria, the other option is used for filtering based on operator and values.
Step 4: In this step select who all can visualize the RUS field. >> proceed to next step.
Step 5: In this step the default selection of “Add the Page layout” >> proceed to Save button.
The Roll-Up Summary field in the “Company Names” displays the highest experience number in the “Maximum Experience” field in the “Company Names” object.
Reparenting allows you to edit the parent details of the Object, which is not allowed to edit.(Eg.Employee).
Click on the “Employee” Object edit >> Custom fields and relationships >> Edit >> master-Detail Options >> Allow Reparenting >> Save.
After Save Go to Employees Object >> Select Employee >> Edit >> Option to select Company Name.
In the next topics, we will discuss in detail about “Salesforce Security”. Keep following us for more info on Salesforce Administration.
Mindmajix offers different Salesforce certification training according to your desire with hands-on experience on Salesforce concepts
|Salesforce Administration Training||Salesforce Lightning Training|
|Salesforce Advanced Developer Training||Salesforce Developer Training|
|Salesforce IoT Training||Salesforce App Builder Certification Training|
|Salesforce AppExchange Training||Salesforce Service Cloud Training|
|and many more.|
Arogyalokesh is a Technical Content Writer and manages content creation on various IT platforms at Mindmajix. He is dedicated to creating useful and engaging content on Salesforce, Blockchain, Docker, SQL Server, Tangle, Jira, and few other technologies. Get in touch with him on LinkedIn and Twitter.