Back to insights

Data Architecture, Record Ownership & Relationship Design

A Salesforce master-detail relationship is an ownership contract—not a lookup shortcut

JSBC Labs8 min read

The relationship changes who owns the record

A team models Invoice Lines beneath an Invoice and chooses master-detail because it enables a native total. Six months later, finance asks for line-level work queues, regional sharing exceptions and an independent retention rule. The detail object has no usable Owner field, its access follows the invoice and deleting the invoice removes the lines. A field chosen for aggregation has quietly decided the operating model.

The JSBC Labs position is that a Salesforce master-detail relationship is an ownership contract—not a lookup shortcut. Salesforce documents that the master controls key behaviours of the detail: ownership, visibility, required association, cascade deletion and native roll-up summaries. Those are useful guarantees when parent and child form one business aggregate. They are expensive coupling when the child needs an independent lifecycle.

Start with the aggregate boundary

Before selecting a relationship type, ask whether the child has meaning without its parent. Can it be created first and linked later? Can a different team own it, can it outlive the parent, or can users see it without seeing the parent? If any of those answers is yes, a lookup may express the real business boundary more honestly, even when native roll-ups would be convenient.

Use master-detail when the records are parts of one consistency boundary: for example, a claim and its claim lines, or a survey response and its answers. Document the invariant in business language. State why the child must always have a parent, why parent visibility is correct, and what must happen when the parent is removed. The schema should preserve a rule the organisation intends to keep—not compensate for a missing calculation tool.

Treat inherited access as a security decision

Salesforce states that detail records inherit sharing and security settings from the master. The detail object does not expose normal record ownership and cannot use sharing rules, manual sharing or queues that depend on an Owner field. This can simplify security because the aggregate has one access boundary, but it also removes the ability to grant or restrict record access independently at the detail layer.

Model real personas before committing. Test the parent owner, collaborators, integration identities, service users and audit roles against both objects. Field-level security still matters because access inherited from the parent does not make every detail field appropriate for every viewer. If a sensitive child needs a narrower audience than its parent, master-detail is likely the wrong boundary; hiding the related list does not repair the record-access model.

Make cascade deletion an explicit lifecycle policy

Deleting a master record also deletes its related detail and subdetail records, and restoring the master from the Recycle Bin restores those children in the documented cases. That behaviour is not merely database housekeeping. It decides what evidence, history and operational work disappears when a user, integration or retention job deletes the parent.

Define deletion authority and impact before deployment. Decide whether detail records must be archived, anonymised, placed on legal hold or reconciled externally before a master can be removed. Include child counts and consequences in destructive user journeys. Test delete and undelete with realistic hierarchies, automation and integrations. A cascade is desirable when children are inseparable components; it is dangerous when the organisation assumes they are durable records in their own right.

Price the roll-up into every child transaction

Native roll-up summary fields can count detail records or calculate sums, minimums and maximums on the master. Salesforce also documents that child changes can update the parent's roll-up value, that validation on the parent can affect a child save, and that certain definition changes trigger mass recalculation. The aggregate is convenient precisely because the platform maintains it as part of the relationship contract.

Treat that convenience as transaction coupling. Inventory every roll-up and every automation, validation rule or integration that reacts to the parent value. Test bulk inserts, transfers, deletes and concurrent updates against parents with production-like child volumes. If the calculation is informational rather than transactional, consider an asynchronous or analytical aggregate. A native roll-up is excellent when the parent must be correct at commit; it is costly when every child write unnecessarily turns one hot parent into shared work.

Reparenting changes more than a foreign key

By default, Salesforce does not allow detail records to be reparented, although administrators can enable reparenting for custom master-detail relationships. Moving a detail then changes the ownership and visibility context and can alter roll-up summaries on both the old and new masters. For junction objects, the primary master relationship also influences inherited ownership and other behaviour.

If reparenting is allowed, govern it as a business event. Define who may move a record, which states permit it, how related balances are reconciled and which downstream consumers need the change. Preserve evidence of the previous parent where auditability requires it. Do not enable the option solely to make data cleanup easier; a correction that changes access, totals and responsibility needs validation, monitoring and a rollback plan.

Design for scale before one parent becomes a hotspot

Salesforce's object-relationship guidance recommends keeping a master-detail relationship below 10,000 children as a best practice. Salesforce Architects describes data skew at similar concentrations as a source of degraded query performance and row-lock contention. The precise production risk depends on workload, but the direction is clear: an unbounded aggregate can turn a clean schema into a concurrency bottleneck.

Estimate child growth per parent, including history, retries and imported records. Identify universal holding parents, default buckets and long-lived accounts that will accumulate far beyond the median. Partition by a genuine business key where possible, archive expired children and avoid synchronous jobs that repeatedly touch the same master. Load-test concurrent child writes and roll-up updates; average parent size will not expose the one record that dominates production contention.

Migrate the relationship as a controlled release

Salesforce permits lookup-to-master-detail conversion only when applicable child records have a parent value. Its deployment considerations also warn that soft-deleted detail records can be permanently removed during certain master-detail deployments, and converting relationship types changes sharing defaults and can affect reports. A successful metadata deployment therefore does not prove that the data or access model survived correctly.

Profile nulls, orphaned records, child concentration, sharing and report dependencies before conversion. Backfill parent keys with reconciled counts, preserve recoverable exports and test representative personas in a full-copy environment. After deployment, verify ownership, visibility, roll-ups, delete behaviour, integrations and reporting—not only field creation. Record the decision and its exit cost. Master-detail is valuable when its guarantees match the business aggregate; it becomes technical debt when teams discover those guarantees only after production data depends on them.

Official references

Continue reading