Learn Salesforce – Master Detail working project make money

Salesforce – Master Detail Relationship



Unlike the relationships in relational database, the relationships in Salesforce are not through Primary and Foreign Keys. The relationships are maintained by using the Relationship Fields. It is a custom field which links one object record to another. Through the creation of relationships, we can display the data of all the related records in the record”s details page.

The Master Detail relationship is used when we want to control the display of detail records based on the value in the master record. For example, in the courier company model a delivery schedule is always linked to a delivery location. If we remove a delivery location from our list, then all the related delivery schedules should also be eliminated. Such a dependency can be achieved through Master-detail relationship between the sales force objects.

Features of Master-Detail Relationship

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

  • Deleting a Master Record, deletes all the detail records.

  • A detail record cannot be created 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 inherits the sharing rule from master records.

  • Both the master and detail records are automatically included in the report record types.

Creating Master-detail Relationship

In the courier company example, we will consider the relationship between delivery location and delivery schedule. There is a many-to-one relationship between the delivery schedule records and the delivery location record.

Following 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 below.

Master Detail1

Choose the Related Object

In the next step, select the object with which this relationship will be created. We choose DeliveryLocation.

Master Detail2

Name the Relationship and Field

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

Master Detail3

Add field to page layout

In the Next step we accept the defaults and move on to add the reference field to the page layout.

Master Detail4

Add Custom Related Lists

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

Master Detail5

This completes the creation of Master-Detail relationship between DeliveryLocation and Deliveryschedule.

Leave a Reply

Your email address will not be published. Required fields are marked *