Salesforce Master Detail Relationship - Salesforce

What is Salesforce Master Detail Relationship?

Unlike the relationships in relational database, the relationships in Salesforce are not over Primary and Foreign Keys. The relationships are upheld by using the Relationship Fields. It is a custom field which relates one object record to another. Over the creation of relationships, we can show the data of all the related records in the record's details page.

The Master Detail relationship is used when we need to control the show of detail records based on the value in the master record. For instance, in the courier company model a delivery schedule is constantly linked to a delivery location. If we eliminate a delivery location from our list, then all the connected delivery schedules must also be eliminated. Such a dependence can be realized through Master-detail relationship between the sales force objects.

Features of Master-Detail Relationship

In this unit, we will debate the features of Master-detail Relationship. The features are listed below −

  • Erasing a Master Record, erases all the detail records.
  • A detail record cannot be formed without a Master record.
  • The permission on the detail record cannot be set. It inherits the permission from the master record.
  • The detail record also gets the sharing rule from master records.
  • Both the master and detail records are mechanically included in the report record types.

Creating Master-detail Relationship

In the courier company instance, we will reflect the relationship amongst delivery location and delivery schedule. There is a many-to-one relationship amongst the delivery schedule records and the delivery location record.

Resulting are the steps followed to create this relationship −

Choose the Relationship Type

In setup home, find the object named Delivery Schedule. In it under the Custom Fields and Relationships related list, click New. Choose the Master-detail Relationship as shown in the screenshot underneath.


Choose the Related Object

In the next step, choose the object with which this association will be formed. We choose DeliveryLocation.


Name the Relationship and Field

In this step, enter the Relationship Name as well as the name of the Field.


Add field to page layout

In the Resulting step we receive the defaults and move on to add the reference field to the page layout.


Add Custom Related Lists

Following, we specify the title for the related list that is related layout with the parent.


This finishes the creation of Master-Detail relationship amongst DeliveryLocation and Deliveryschedule.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Salesforce Topics