# What are the defining behavioral characteristics and security impacts of a Master-Detail relationship?

**Topic:** Admin · **Difficulty:** Medium · **Tags:** Admin, Object Relationships, Master-Detail

Read it on the site: https://www.forcechallenges.com/interview-questions/what-are-the-defining-behavioral-characteristics-and-security-impacts-of-a-master-detail-relationship

## Answer

**Basics:** Use it when the child cannot exist without the parent, such as invoice line items under an invoice. Salesforce enforces the dependency for you, so no orphan records.

**How it works:**
- The relationship field on the child is always required; a child cannot be saved without a master.
- The child has no Owner field. Visibility is "Controlled by Parent" in sharing settings, and access follows the master record (plus the user's object permissions on the child).
- Deleting the master cascade-deletes details; undeleting the master restores them.
- Master-detail enables Roll-Up Summary fields on the master.
- Setup: Object Manager > child object > Fields & Relationships > New > Master-Detail Relationship.

**Advanced / deep dive:** An object can have up to two master-detail relationships; this is how a junction object models many-to-many, and the first (primary) relationship determines the look and feel and the default ownership/sharing behavior of the junction. Reparenting is blocked unless "Allow reparenting" is ticked. Standard objects cannot be the detail side of a custom master-detail (only custom objects can be detail, with some exceptions in managed packages and standard like OpportunityLineItem). Converting lookup to master-detail needs every existing record to have the parent populated, and master-detail to lookup requires removing roll-ups first. Sharing rules and manual sharing cannot be created directly on the detail; share the master instead. Because roll-ups lock the parent, bulk loading many children against one parent invites UNABLE_TO_LOCK_ROW; sort the file by parent in Data Loader and use smaller or serial batches.

**Hidden gotchas & must-remember points:**
- Maximum two master-detail fields per object, and the field is always required.
- There is no owner on the detail, so you cannot use owner-based sharing rules or queues for it.
- Cascade delete cannot be turned off; use lookup with a restrictive delete option if you must prevent deletion.
- Changing the parent (reparenting) is off by default and the child's sharing is recalculated when it happens.
- Roll-up summaries are available only on the master side of this relationship type.
- A master with many children counts toward parent record locking and skew problems (more than about 10,000 children is considered data skew).
- Master-detail on a junction object makes deletion of either master delete the junction rows.

**Best practice:** Choose master-detail only when the lifecycle, security and roll-up needs truly match the parent; otherwise start with lookup, which is easier to relax later.

---
Source: ForceChallenges · last updated 2026-11-02
