Master-Detail Relationship in Salesforce

I worked for an organization that uses Salesforce CRM to manage the employee management application.

Recently, HR asked me to update the application to include an employee field for reimbursement applications. When the employee clicks that field, it shows all employees in the list, and without filling that field, the record should not get saved.

To achieve that requirement in Salesforce, we have a master-detail relationship field. Here, I will explain master-detail relationships in Salesforce, and then I will explain how to create master-detail relationships in Salesforce.

Master-Detail Relationship in Salesforce

In Salesforce, the master-detail relationship allows us to access data from one object to another. We used parent-child terminology to access parent records in the child object. It is a strongly coupled relationship, which means it allows the parent to control the child’s records.

Salesforce allows us to create master-detail relationships in the Professional, Enterprise, Performance, Unlimited, and Developer editions. We can create a master-detail relationship in both the Salesforce Lightning and Salesforce Classic user interfaces.

Characteristics of Master-Detail Relationships:

  • We create MDR on many sides of an object. The MDR field is always required.
  • In MDR, the child object’s records don’t exist without the parent, which means that when the parent records are deleted, the child records associated with the parent are also deleted.
  • We can create only two MDRs per object. When we use this, we have the option to use the rollup summary field.
  • We can use the roll-up summary field on the parent object.

Use of Master-Detail Relationship in Salesforce

In Salesforce, we can use MDR to access the parent records in the child object or to apply the cross-object formula. Also, to enhance security between two objects, if parent records are deleted, then child records should also be deleted; we can use MDR.

  • It is a strongly coupled