English 中文(简体)
Salesforce - Master Detail
  • 时间:2024-12-22

Salesforce - Master Detail Relationship


Previous Page Next Page  

Unpke 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 pnks 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 depvery schedule is always pnked to a depvery location. If we remove a depvery location from our pst, then all the related depvery schedules should also be epminated. 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 psted 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 depvery location and depvery schedule. There is a many-to-one relationship between the depvery schedule records and the depvery location record.

Following are the steps followed to create this relationship −

Choose the Relationship Type

In setup home, find the object named Depvery Schedule. In it under the Custom Fields and Relationships related pst, cpck 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 DepveryLocation.

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 pst that is associated layout with the parent.

Master Detail5

This completes the creation of Master-Detail relationship between DepveryLocation and Depveryschedule.

Advertisements