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.
Choose the Related Object
In the next step, select the object with which this relationship will be created. 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 Next step we accept the defaults and move on to add the reference field to the page layout.
Add Custom Related Lists
Next, we specify the title for the related list that is associated layout with the parent.
This completes the creation of Master-Detail relationship between DeliveryLocation and Deliveryschedule.
No comments:
Post a Comment