Master Detail Vs. Lookup Relationship in Salesforce

When designing data model in Salesforce, deciding between a master-detail relationship and a lookup relationship is a crucial step. Each option has its advantages, drawbacks, and limitations that need to be carefully considered.

In this blog post, we have outlined key factors to consider when choosing between a master-detail and lookup relationship in Salesforce. Assess these criteria based on your business needs to make a well-informed decision.

Considerations for Choosing Between Master-Detail Vs. Lookup Relationship

Master-Detail RelationshipLookup Relationship
Restriction on creation of fieldIn master-detail relationship, standard objects cannot be on detail/child side of the relationship.In lookup relationship, you can create look fields on standard/custom objects to other standard/custom objects.
Specifying parent record mandatory?In a master-detail relationship, it is required to specify the parent record on the child record.In a lookup relationship, you have the option to decide whether specifying the parent record is mandatory.
Sharing/visibility of child recordsIn a master-detail relationship, the visibility of child records is determined by the visibility of the parent record. You do not have direct control over the sharing or visibility settings of child records.In a lookup relationship, you have the ability to set sharing settings for child records separately from those of the parent record.
Impact on deletion of parent recordIn a master-detail relationship, when the parent record is deleted, the child records associated with it are also automatically deleted.In a lookup relationship, you have the flexibility to control the behavior of child records when a parent record is deleted. You can choose to automatically delete the child records1, restrict deletion of the parent record if there are associated child records, or clear the value of the parent record in the child records.
Roll-up SummaryIn a master-detail relationship, you have the ability to create a roll-up summary field on the parent object record to aggregate and display values from related child records.In a lookup relationship, there is no built-in feature to automatically aggregate values from child records to the parent record.
Governor LimitA child object can have a maximum of two master-detail relationships.A child object can have up to 50 lookup relationships.

1. To enable the feature of automatically deleting child records when a parent record is deleted in a lookup relationship, you will need to log a case with Salesforce. For more information, please refer to the blog post “Cascade Delete on Lookup Relationship in Salesforce

Other Considerations for Master-Detail Relationship

  • Master detail relationship can be converted to lookup if no roll-up summary fields have been defined on parent object
  • Master-detail relationship cannot be created on a custom object if it already has any records created
  • If detail record is deleted first then the parent is deleted separately then detail record cannot be undeleted because its parent record no longer exist

References & Useful URLs

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
Introducing All Access Pass