The Master Detail relationship is used when a user wants to manage the display of detail records based on the value reflected in the master record. As an example, in a courier company, it is always that the delivery schedule is based on the delivery location. If a delivery location has been deleted, Salesforce will also delete schedules related to that location. This relationship can be established using the Master Detail function.
Features
The Master Detail function carries the following features:
-
Delete Master Record – This deletes all detail records.
-
No Creation of Detail Record – This can’t be done without changing the Master Record first.
-
No Permission – If it is not permitted by the Master Record, a user cannot set the detail record.
-
Inherit the Same Sharing Rule – Whatever sharing rules the Master Record has, the same rules are applicable in the detail records.
Both the detail and master records are automatically included in the report record types.
How to Create a Master-Detail Relationship
In the example we’ve mentioned above, we will take into account the relationship between the location and schedule. The relationship defined in this kind of relationship is many-to-one. That is, for every location, there are many related schedules.
Following are the steps to create a master-detail relationship for this particular case:
-
Go to Setup and look for the object designated as Delivery Schedule.
-
Go to the Custom Fields and Relationships related list.
-
Click New.
-
Click the Master-Detail Relationship button.
-
On the next page, choose the object Delivery Location.
In the Master-Detail Relationship page, you can choose from the other two options. Another option is Lookup Relationship and the last one is External Lookup Relationship. The Lookup Relationship allows creating of a relationship between objects internally, but not with the parent-child relationship that the Master-Detail features. The External Lookup Relations allows relating with objects outside the org.