# How do organization-wide defaults and sharing rules protect sensitive customer case data in Service Cloud?

**Topic:** Service Cloud · **Difficulty:** Medium · **Tags:** Service Cloud, Security Models, Sharing Settings

Read it on the site: https://www.forcechallenges.com/interview-questions/how-do-organization-wide-defaults-and-sharing-rules-protect-sensitive-customer-case-data-in-service-cloud

## Answer

**Basics:** Cases can include sensitive customer information. OWD sets the baseline access for each object; everything else only grants additional access. The goal is least privilege for internal agents and strict isolation for customers and partners.

**How it works:**
1. Set the Case OWD (Private, Public Read Only, Public Read/Write, or Public Read/Write/Transfer), and the separate External OWD for external users (Private is typical).
2. Role hierarchy grants managers access to subordinates' cases (Grant Access Using Hierarchies).
3. Owner-based and criteria-based sharing rules grant access to roles, groups or queues.
4. Case Teams grant record-specific access to chosen users with Read or Read/Write roles (predefined teams automate assignment).
5. For Experience Cloud, customer users see their own cases (contact-based), and sharing sets (Customer Community licenses) or share groups/sharing rules (Plus licenses) extend access to their account's cases.
6. Field-level security and page layouts hide sensitive fields.

**Advanced / deep dive:** Account-based implicit sharing: access to an Account can give related Case access depending on role settings. Queue ownership: queue members get access as owners via the queue. Apex managed sharing on Case can insert CaseShare records (RowCause Manual only; standard objects cannot define custom sharing reasons). For regulated data, add Shield Platform Encryption, Event Monitoring and field audit. Large data volumes: avoid excessive sharing rules and complex role hierarchies, which slow recalculation. Make external user performance predictable by using sharing sets instead of heavy sharing rules where possible.

**Code / config example:**
```apex
public with sharing class CaseShareService {
  public static void grantEdit(Map<Id, Id> caseToUser) {
    List<CaseShare> shares = new List<CaseShare>();
    for (Id caseId : caseToUser.keySet()) {
      shares.add(new CaseShare(CaseId = caseId, UserOrGroupId = caseToUser.get(caseId),
                               CaseAccessLevel = 'Edit', RowCause = 'Manual'));
    }
    Database.insert(shares, false); // partial success; inspect SaveResult in production
  }
}
```

**Hidden gotchas & must-remember points:**
- Sharing can only grant access beyond OWD, never restrict below it.
- Customer Community users and Plus users have different sharing mechanisms.
- Case Teams only matter when OWD is Private or Public Read Only.
- External OWD must be at least as restrictive as internal OWD.
- Knowledge visibility uses data categories and channels, not Case sharing.
- Changing OWD triggers recalculation that can take hours in large orgs.

**Best practice:** Start with Private, add the minimum sharing needed, and test using Login As for internal and external roles.

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