How do sharing rules and role hierarchies protect sensitive customer and deal data in Sales Cloud?
Answer
Basics: Two separate questions are answered: what can a user do with an object and field (profiles, permission sets, field-level security), and which individual records can they see (OWD, hierarchy, sharing). Sales usually sets Account, Contact and Opportunity OWD to Private so reps see only what they own.
How it works:
- OWD is the most restrictive baseline (Private, Public Read Only, Public Read/Write, Controlled by Parent; Lead and Case add Public Read/Write/Transfer).
- Role hierarchy gives managers access to subordinates' records (Grant Access Using Hierarchies).
- Sharing rules (owner-based or criteria-based) extend Read or Read/Write to roles, groups or territories.
- Account Teams, Opportunity Teams and manual sharing grant record-by-record access.
- Apex managed sharing writes __Share rows with a custom RowCause for logic rules cannot express.
- Implicit sharing gives parent/child visibility, for example access to an Opportunity grants read on its Account.
Advanced / deep dive: Sharing never restricts below OWD; to hide records you need a stricter OWD or restriction rules. Restriction Rules and Scoping Rules (newer features) can limit what users see even when sharing would allow it. View All and Modify All object permissions and View All/Modify All Data bypass sharing and are common leaks. Sharing recalculation is costly on large orgs; use Defer Sharing Calculations for big role or rule changes. Limits to remember: up to 300 sharing rules per object, with criteria-based rules limited to 50 per object; check current docs. Guest users have tighter sharing defaults. Layer Shield Platform Encryption for data at rest for highly sensitive fields.
Code / config example:
// Grant read access to an Account via Apex managed sharing
(
AccountId = acctId, UserOrGroupId = userId,
AccountAccessLevel = , OpportunityAccessLevel = ,
RowCause = );
insert s;