Advanced 15 min read

How Object Relationships Affect Sharing

By the end of this lesson, you'll be able to:

  • Explain how master-detail relationships propagate sharing from parent to child
  • Design a schema decision around sharing implications, not just data structure

Prerequisites: Field Types and When to Use Them

Master-detail: sharing follows the parent

A detail record has no owner or sharing of its own — if a user can see the master, they can see every detail record beneath it (subject to field-level security on individual fields). This is often desirable (line items should be visible whenever the parent Order is) but can be wrong when the child genuinely needs its own, different visibility rules.

Lookup: independent sharing, by design

Because a lookup child has its own owner and Organization-Wide Default, its visibility is governed separately from its parent — sometimes exactly right (a Case shouldn't necessarily be visible to everyone who can see the related Account), sometimes a source of confusing "why can I see the Account but not this related record" support tickets if the OWD wasn't set deliberately.

Two relationship types, two sharing stories

-- OpportunityLineItem (master-detail child of Opportunity):
-- visible to anyone who can see the parent Opportunity, automatically
SELECT Id, OpportunityId, Quantity FROM OpportunityLineItem

-- Case (lookup-related to Account):
-- has its own OWD, independent of who can see the Account
SELECT Id, AccountId, Status FROM Case

This is exactly why line items "just work" visibility-wise once you can see the Opportunity, while Case access needs its own deliberate sharing configuration — the two relationship types have fundamentally different sharing behavior.

Exercise

A custom object 'Performance_Review__c' should be visible only to a manager and HR, even though it's related to an Employee__c record many people can see. Which relationship type fits, and why not the other?

Show hint

Think about whether the child should inherit the parent's visibility, or need its own independent, more restrictive access.

SOQL

How Object Relationships Affect Sharing — Quick Check

1. How does a master-detail child's visibility work?

2. A lookup-related child object has its own Organization-Wide Default, independent of its parent.

3. When would a lookup relationship be the better sharing choice over master-detail?

Log in to submit the quiz and save your score.

My Notes

Log in to keep private notes on this lesson.

Questions about this lesson

No questions yet — be the first to ask.

Log in to ask a question about this lesson.

Summary

A schema decision isn't just about data shape — master-detail children automatically inherit their master's sharing and visibility, which can be exactly what you want, or a design mistake if the child needed independent access control.