Master-Detail Relationship

Core CRM 🟡 Intermediate
📖 4 min read

Definition

A Master-Detail Relationship in Salesforce creates a tightly coupled parent-child link between two objects. The detail (child) record inherits the sharing and security settings of the master (parent), the lookup field is always required, and deleting the master record cascades to delete all related detail records. This relationship type enables Roll-Up Summary Fields on the master object.

Real-World Example

An admin at BlueSky Travel creates a Master-Detail Relationship between the Trip Package (master) and Trip Itinerary Item (detail) objects. Each Itinerary Item must belong to exactly one Trip Package. If a Trip Package is deleted, all its Itinerary Items are automatically deleted too. The admin adds a Roll-Up Summary Field on Trip Package that sums the Cost of all Itinerary Items.

Why Master-Detail Relationship Matters

A Master-Detail Relationship is one of the most powerful relationship types in Salesforce's data model. It creates a tightly coupled parent-child bond where the child (detail) record cannot exist without a parent (master). Unlike a Lookup Relationship, the detail record inherits sharing and security settings from the master, the relationship field is always required, and deleting the master cascades to delete all detail records. Most importantly, Master-Detail Relationships unlock Roll-Up Summary Fields, which let you aggregate data from child records — SUM, COUNT, MIN, MAX — directly on the parent record without code or automation.

As organizations build complex data models, Master-Detail Relationships become essential for maintaining data integrity and enabling real-time aggregation. A common pattern is using them for line items on orders, invoice entries, or project tasks tied to a parent project. However, misusing Master-Detail Relationships carries consequences: you cannot reparent a detail record to a different master (by default), each object is limited to two Master-Detail Relationships, and deleting a master record with thousands of children can hit governor limits or trigger unexpected cascade deletes. Planning your data model carefully and choosing between Lookup and Master-Detail based on your actual business rules prevents costly rework later.

How Organizations Use Master-Detail Relationship

  • BlueSky Travel — BlueSky Travel uses a Master-Detail Relationship between Trip Package (master) and Itinerary Item (detail). Each Itinerary Item has a cost, and a Roll-Up Summary Field on Trip Package automatically sums all line item costs to display the total package price. When a Trip Package is cancelled and deleted, all associated Itinerary Items are automatically cleaned up, preventing orphaned records.
  • Vertex Construction — Vertex Construction created a Master-Detail Relationship between Project (master) and Work Order (detail). They use Roll-Up Summary Fields to count the number of open Work Orders per Project and calculate the total estimated hours. Project managers get a real-time dashboard view without waiting for batch calculations, and sharing settings ensure subcontractors only see Work Orders for projects they are assigned to.
  • Summit Learning Academy — Summit Learning Academy tracks student enrollment with a Master-Detail Relationship between Course Section (master) and Enrollment (detail). A Roll-Up Summary Field counts enrolled students per section, automatically enforcing capacity limits via a validation rule. When a Course Section is archived at semester end, all associated Enrollment records cascade delete, keeping the database clean without manual intervention.

🧠 Test Your Knowledge

See something that could be improved?

Suggest an Edit