By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
(For Admins Who Need to Secure Data Without Breaking Production)
Sharing rules in Salesforce are automated exceptions to your org-wide defaults (OWD). Think of OWD as the "default lock" on all records—sharing rules are the "master keys" you hand out to specific groups when the default lock is too restrictive.
Why this matters in production: - Security: If you don’t set up sharing rules correctly, users either see nothing (frustrating) or everything (a compliance nightmare). - Performance: Poorly designed sharing rules can slow down record access, especially in large orgs. - Audit & Compliance: Regulatory frameworks (GDPR, HIPAA, SOX) often require strict data access controls. Sharing rules are your first line of defense.
Real-world scenario: You’re the Salesforce Admin for a healthcare org. The Org-Wide Default (OWD) for Patient__c records is Private (only the record owner can see it). But: - Doctors need to see all patients in their department. - Billing teams need to see patients assigned to their region. - A single auditor needs temporary access to a patient’s record for a compliance review.
Patient__c
Without sharing rules: - Doctors can’t see their department’s patients-work stops. - Billing teams manually request access-delays and errors. - The auditor has to email IT for access-security risk.
With sharing rules: - Doctors automatically see their department’s patients. - Billing teams see patients in their region. - The auditor gets manual sharing access for 24 hours.
This guide will show you how to set this up without breaking existing security.
Private
Public Read-Only
Public Read/Write
Region__c = "West"
Read
Read/Write
Full Access
AccountId
Account
Contacts
You have System Administrator access. ? You’ve set Org-Wide Defaults (OWD) for the object (e.g., Patient__c = Private). ? You have a sandbox (recommended) or a dev org to test in.
Goal: Automatically share Patient__c records with doctors in the same department.
Cardiology Doctors
Cardiology_Doctors
Doctor - Cardiology
(Repeat for other departments, e.g., Neurology Doctors.)
Neurology Doctors
Based on criteria
Share with Cardiology Doctors
Department__c
equals
Cardiology
Public Groups
Read Only
Patients
Department__c = "Cardiology"
Goal: Automatically share Patient__c records with billing teams based on region.
West Region Billing
West_Region_Billing
Billing - West
Based on record owner
Share West Region Patients with Billing
Roles
Doctor - West
Goal: Temporarily grant an auditor access to a single patient record.
Compliance Audit - 24-hour access
Least Privilege: Start with Private OWD and only open access via sharing rules where necessary. ? Avoid "View All" Permissions: If a user needs access to a subset of records, use sharing rules instead of View All on their profile. ? Audit Manual Shares: Use Setup-Sharing Settings-View All Manual Shares to track who has access to what. ? Use Public Groups, Not Individual Users: Sharing rules should reference groups, not individual users, for scalability.
View All
Limit Sharing Rules per Object: Salesforce recommends no more than 300 sharing rules per object. If you hit this limit, use Apex managed sharing instead. ? Avoid Complex Criteria: Sharing rules with formulas or cross-object references slow down recalculation. Keep criteria simple (e.g., Department__c = "Cardiology"). ? Schedule Recalculations: If you make bulk changes, schedule recalculations during off-peak hours (Setup-Sharing Settings-Recalculate).
Test in Sandbox First: Sharing rules can unintentionally expose data. Always test in a sandbox before deploying to production. ? Document Why Rules Exist: Add a description to each sharing rule explaining its purpose (e.g., "Grants Cardiology Doctors access to their department’s patients"). ? Use Naming Conventions: - SR_[Object]_[Group]_[AccessLevel] (e.g., SR_Patient_Cardiology_ReadOnly). - PG_[GroupName] (e.g., PG_Cardiology_Doctors).
SR_[Object]_[Group]_[AccessLevel]
SR_Patient_Cardiology_ReadOnly
PG_[GroupName]
PG_Cardiology_Doctors
Monitor Sharing Recalculation: If users report missing records, check Setup-Sharing Settings-Recalculate for errors. ? Use Reports to Audit Access: - Report Type: Users with Access to Records - Filter by object and user to see who can access what. ? Set Up Alerts for Manual Shares: Use Process Builder or Flow to notify admins when a record is manually shared.
Users with Access to Records
Owner-based: When sharing depends on who owns the record (e.g., "All records owned by Team A").
"What’s the difference between a public group and a queue?"
Queue: Used for record ownership (e.g., "Assign records to this queue").
"Can sharing rules override OWD?"
No. Sharing rules extend access but cannot restrict it. If OWD is Public Read/Write, sharing rules won’t help.
"How do you grant temporary access to a single record?"
Manual sharing (not a sharing rule).
"What happens if a user’s role changes?"
Public
"A sales rep needs to see all Opportunities owned by their team, but OWD is Private. What’s the best solution?" ? Answer: Create an owner-based sharing rule to share records owned by the team with the rep. ? Wrong Answers: - "Change OWD to Public Read-Only" (too permissive). - "Use manual sharing" (not scalable). - "Grant the rep 'View All' permission" (overkill).
You’re the admin for a real estate org. The OWD for Property__c is Private. Agents should only see properties in their region, but managers should see all properties.
Property__c
Your task:1. Create a public group for "East Region Agents."2. Create a criteria-based sharing rule to share Property__c records where Region__c = "East" with the group.3. Verify the rule works by logging in as an East Region Agent.
Region__c = "East"
East Region Agents
East_Region_Agents
Add all East Region Agent roles to the group.
Create the Sharing Rule:
Share East Region Properties
Region__c equals East
Access Level: Read Only
Test:
Why it works: - The sharing rule extends access beyond the Private OWD for the specified group. - Managers (higher in the role hierarchy) automatically see all properties.
Sharing rules are your scalpel—they let you carve out precise access without swinging the Public Read/Write sledgehammer. Master them, and you’ll keep data secure while letting users do their jobs. Test in sandbox, document everything, and recalculate after changes. Now go build something secure! ?
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.