Master-Detail Relationships
A Master-Detail Relationship in Salesforce is a tightly coupled parent-child relationship between two objects, where the master (parent) object controls certain behaviors of the detail (child) object. This concept is a key topic in the Platform Administrator II exam under Objects and Applications, because it directly affects data model design, security, and automation. Key characteristics: 1. Required field: The master-detail field on the child record is required. A detail record cannot exist without a master record. 2. Cascade delete: When a master record is deleted, all related detail records are automatically deleted. Undeleting the master restores the children. 3. Ownership and sharing: Detail records do not have their own Owner field. They inherit ownership and sharing settings from the master record, so you cannot set an Org-Wide Default or sharing rules directly on the detail object. 4. Roll-up summary fields: Master-detail enables roll-up summary fields on the master object to calculate COUNT, SUM, MIN, or MAX of child records. This is not available with lookup relationships. 5. Reparenting: By default, the child cannot be moved to a different parent, but an admin can enable 'Allow reparenting' on the field definition. 6. Limits: A custom object can have up to two master-detail relationships. Standard objects cannot be the detail side of a master-detail relationship with a custom object as master. 7. Many-to-many relationships: A junction object with two master-detail fields creates a many-to-many relationship between two objects, with the first master-detail field defining the primary relationship (affecting look and feel and record ownership). 8. Conversion: You can convert a lookup to master-detail only if every child record already has a parent value, and convert master-detail to lookup if no roll-up summary fields exist on the master. Understanding when to choose master-detail versus lookup is essential: use master-detail when child records are meaningless without the parent, require roll-up calculations, or should share the parent's security model.
Master-Detail Relationships: A Complete Guide for the Salesforce Advanced Administrator Exam
Master-Detail relationships are one of the most heavily tested data modeling concepts on the Salesforce Advanced Administrator exam. They sit at the heart of the Advanced Objects and Applications domain because they govern record ownership, security inheritance, deletion behavior, and roll-up summary capabilities. If you misunderstand them, you will struggle with questions on sharing, reporting, roll-ups, junction objects, and data migration. In real-world administration, choosing Master-Detail versus Lookup is a foundational architectural decision that is difficult and sometimes impossible to reverse once records exist, so Salesforce expects certified admins to make that choice correctly.
What a Master-Detail Relationship Is
A Master-Detail relationship is a tightly coupled parent-child link between two objects. The master (parent) record controls specific behaviors of the detail (child) record. The detail record cannot exist without a master; the relationship field on the detail object is always required. Think of it as an ownership hierarchy: the child belongs to the parent in every meaningful sense.
Key characteristics:
• The master-detail field on the detail object is required and appears on the page layout automatically.
• Deleting the master record cascade-deletes all detail records. Undeleting the master restores the details.
• Detail records inherit security and sharing from the master. The detail object has no Owner field and no Organization-Wide Default of its own (OWD is set to Controlled by Parent).
• The master object can have roll-up summary fields (COUNT, SUM, MIN, MAX) that aggregate detail record values.
• A custom object can have at most two master-detail relationships, enabling many-to-many designs through a junction object.
• Standard objects can be the master but cannot be the detail in a master-detail relationship with a custom object.
• You can have up to three levels of master-detail hierarchy (grandparent, parent, child) with custom objects.
How It Works in Practice
Creation. You create the master-detail field on the detail (child) object, not the master. When you create the field, you choose whether the parent can be reparented via the Allow Reparenting checkbox. By default, once a detail record is saved with a master, that master cannot be changed unless reparenting is enabled.
Sharing and Access. The sharing setting you define on the master-detail field determines what access a user needs on the master to create, edit, or delete detail records. The two options are: users need at least Read access to the master, or users need at least Read/Write access to the master. There is no independent sharing model for the detail object; sharing rules, manual sharing, and role hierarchy all apply at the master level and flow down.
Roll-Up Summaries. Because the relationship is tight, Salesforce can efficiently maintain aggregate fields on the master. Roll-ups can count detail records, or sum/min/max numeric, currency, percent, date, or date/time fields on the detail. You can filter which detail records are included using criteria. Roll-up summary fields are only available with master-detail, never with standard lookup relationships (unless you use Flow, Apex, or AppExchange tools as workarounds).
Junction Objects. A custom object with two master-detail relationships is a junction object, creating a many-to-many relationship. The first master-detail relationship you create becomes the primary relationship. The primary master determines the look and feel (record detail page color and icon) of the junction object and the sharing rules the junction record follows. If either master is deleted, the junction record is deleted.
Converting Relationships. You can convert a Lookup to Master-Detail only if every existing child record has a value in the lookup field. You can convert Master-Detail to Lookup only if there are no roll-up summary fields on the master object that depend on that relationship.
Record Ownership. Detail records do not have their own owner. The Owner field is not present on the detail object; ownership is derived from the master. This affects queue assignment, ownership-based sharing rules, and reports that filter by owner.
Master-Detail vs. Lookup: Quick Comparison
• Required field: Master-Detail always required; Lookup optional (unless you make it required).
• Deletion: Master-Detail cascades; Lookup can clear the field, prevent deletion, or (with special permission enabled by Salesforce support) cascade.
• Security: Master-Detail inherits from parent; Lookup child has its own OWD and owner.
• Roll-up summaries: Master-Detail yes; Lookup no.
• Standard object as child: Master-Detail no; Lookup yes.
• Maximum per object: Master-Detail two; Lookup forty.
Exam Tips: Answering Questions on Master-Detail Relationships
1. Look for the roll-up summary keyword. If a scenario asks for a total, count, or latest date from child records displayed on the parent with no code, the answer is almost always a master-detail relationship with a roll-up summary field. If the objects are connected by lookup, the correct answer often involves converting to master-detail (if all records have a parent) or using a Flow.
2. Watch for the word required. If the question says the child must always have a parent, or must be deleted when the parent is deleted, master-detail is the intended answer.
3. Security questions are a trap. If a question asks how to set the OWD or create sharing rules on a detail object, remember you cannot. The detail object's access is Controlled by Parent. The correct answer will involve adjusting access on the master.
4. Standard objects cannot be the detail. Any answer suggesting Account, Contact, Opportunity, or Case as the detail side of a master-detail relationship with a custom object is wrong. Standard objects can only be the master.
5. Remember the limit of two. If a scenario needs a custom object related to three parents with cascade delete and roll-ups, that is not possible with master-detail alone; look for an answer that uses a combination of master-detail and lookup or a redesigned data model.
6. Junction object questions. Know that the first master-detail created is primary and controls look-and-feel and sharing. Know that deleting either parent deletes the junction record. Know that junction objects are how you model many-to-many.
7. Conversion scenarios. If asked why a Lookup cannot be converted to Master-Detail, the answer is that some child records have blank lookup values. If asked why Master-Detail cannot be converted to Lookup, the answer is that roll-up summary fields exist on the master.
8. Reparenting. If a scenario says users need to move a child record to a different parent and currently cannot, the fix is to enable Allow Reparenting on the master-detail field definition.
9. Ownership and queues. If a question mentions assigning detail records to queues or sharing them by owner, recognize that detail objects have no owner field, so the design must change or the question is testing whether you know this limitation.
10. Eliminate code-based answers first. The Advanced Administrator exam favors declarative solutions. If a master-detail relationship plus a roll-up summary solves the requirement, choose it over Apex triggers or Flow.
11. Read scenario details carefully. Exam questions often embed one clue that decides between Lookup and Master-Detail, such as independent sharing requirements (points to Lookup) or cascade delete (points to Master-Detail). Identify that clue before evaluating answer choices.
Summary
Master-Detail relationships create a tightly bound parent-child structure where the child inherits sharing, ownership, and deletion behavior from the parent, and the parent gains roll-up summary capability. Master the comparison with Lookup, the two-relationship limit, the standard-object restriction, conversion rules, junction object behavior, and the Controlled by Parent sharing model, and you will be well prepared for every variation of this topic the exam presents.
Admin II - Master-Detail Relationships Example Questions
Test your knowledge of Master-Detail Relationships
Question 1
Universal Containers uses a Job Application junction object with a master-detail relationship to Position, created first, and a second master-detail relationship to Candidate. Recruiting leadership now wants Job Application records to take their look and feel and their ownership from Candidate instead of Position. Every existing Job Application must keep its Position link, and no roll-up summary fields exist on either master. What should the administrator do to meet these requirements?
Question 2
Cloud Kicks has an Expense Report object that is the master of an Expense Line object. The auditors have Read Only access to Expense Reports through a sharing rule, and a permission set gives them Create and Edit on Expense Line. They still cannot add or update line items. They must be able to maintain line items, but they must not be able to edit the reports. What should the administrator do?
Question 3
Cloud Kicks tracks Inspection records against Site records through a lookup field. Managers now want a count of inspections shown on each Site, so the administrator tries to change the lookup to master-detail. Salesforce blocks the change because some older Inspection records have a blank Site value. New inspections will always be logged against a site. What should the administrator do to deliver the requested count?