Criteria-Based Sharing
Learning Content
Last updated: July 21, 2026
Criteria-Based Sharing
Criteria-Based Sharing is a Salesforce declarative sharing mechanism that automatically grants record access to users, roles, or public groups when a record satisfies predefined conditions.
Unlike Triggers, Flows, or Validation Rules, Criteria-Based Sharing does not implement business logic. Instead, it controls who can access a record. When a record is created or updated and its sharing criteria change, Salesforce recalculates the applicable sharing rules to ensure users have the correct level of access.
💡 LearnFrenzy Insight
Imagine a company office with secure departments.
When an employee is assigned to the Finance department, their access badge automatically unlocks Finance rooms. If they transfer to another department, those permissions are updated automatically.
Criteria-Based Sharing works in a similar way by automatically granting or removing access based on record values.
Where Does Criteria-Based Sharing Fit?
Database Save
│
▼
After Trigger
│
▼
Workflow / Flow
│
▼
Roll-Up Summary
│
▼
Commit Transaction
│
▼
⭐ Sharing Recalculation
(Criteria-Based Sharing)
Criteria-Based Sharing is related to Salesforce's sharing engine rather than the core business logic execution sequence. When a transaction commits successfully, Salesforce recalculates record access if sharing-related criteria have changed.
How Criteria-Based Sharing Works
| Step | Description |
|---|---|
| 1 | A record is created or updated. |
| 2 | The transaction completes successfully. |
| 3 | Salesforce evaluates configured Criteria-Based Sharing Rules. |
| 4 | If the record matches the criteria, sharing access is granted or updated. |
| 5 | Users receive the appropriate level of record visibility. |
Common Business Use Cases
| Business Requirement | Criteria-Based Sharing Solution |
|---|---|
| Share High-Value Opportunities | Automatically share Opportunities where Amount exceeds a threshold with Sales Managers. |
| Regional Access | Share Accounts with regional teams based on Region. |
| VIP Customers | Grant access to VIP Account managers when Customer Type = VIP. |
| Priority Cases | Share high-priority Cases with an escalation team. |
| Department-Based Visibility | Share records with a Public Group based on department-specific criteria. |
Real Business Scenario
🏢 Business Example
A company wants all Opportunities with an Amount greater than $500,000 to be visible to the Executive Sales Team.
- A sales representative updates the Opportunity Amount.
- The transaction completes successfully.
- Salesforce evaluates the Criteria-Based Sharing Rule.
- If the Opportunity matches the rule, access is automatically granted to the Executive Sales Team.
No Apex code or manual sharing is required.
Criteria-Based Sharing vs Manual Sharing
| Feature | Criteria-Based Sharing | Manual Sharing |
|---|---|---|
| Configured Once | ✔ Yes | ❌ No |
| Automatic | ✔ Yes | ❌ No |
| Based on Record Values | ✔ Yes | Optional |
| User Intervention | Not Required | Required |
| Best For | Consistent access policies. | Exceptional one-off access. |
Criteria-Based Sharing vs Apex Managed Sharing
| Feature | Criteria-Based Sharing | Apex Managed Sharing |
|---|---|---|
| Requires Apex | No | Yes |
| Complex Logic | Limited | Excellent |
| Maintenance | Easy | Developer Managed |
| Recommended For | Standard sharing scenarios. | Advanced custom access requirements. |
🔍 Behind the Scenes: What Happens Internally?
Record Saved
│
▼
Transaction Committed
│
▼
Sharing Engine Evaluates Rules
│
▼
Criteria Matched?
Yes │ No
│
▼
Grant / Remove Access
│
▼
Updated Record Visibility
The sharing engine is separate from your Apex code and Flow logic. Its responsibility is to maintain accurate record visibility based on your organization's sharing model and configured rules.
Why Criteria-Based Sharing Matters
| Benefit | Explanation |
|---|---|
| Automatic Record Access | Eliminates manual sharing for common scenarios. |
| Improved Security | Ensures only appropriate users can access records. |
| Reduced Administration | Sharing updates automatically as record values change. |
| Declarative Configuration | No Apex required for standard sharing policies. |
✅ Best Practice
Use Criteria-Based Sharing for predictable, rule-driven access requirements. Reserve Apex Managed Sharing for scenarios that cannot be expressed through declarative sharing rules.
⚠️ Common Mistake
Assuming Criteria-Based Sharing is a Trigger or Flow. It is part of Salesforce's record-sharing engine and controls access to records rather than executing business logic.
🎯 Interview Tip
Question: What is the difference between Criteria-Based Sharing and Apex Managed Sharing?
Answer: Criteria-Based Sharing is a declarative feature that automatically grants access based on configurable record criteria. Apex Managed Sharing is developer-controlled and is used when sharing requirements involve complex business logic that declarative sharing rules cannot support.
📌 Quick Revision
- ✔ Declarative record-sharing mechanism.
- ✔ Controls record visibility, not business logic.
- ✔ Evaluates sharing rules after a successful transaction.
- ✔ Automatically grants or removes access based on record criteria.
- ✔ No Apex required for standard sharing scenarios.
- ✔ Commonly compared with Apex Managed Sharing in interviews.
➡ Next Lesson
In the next lesson, you'll learn about the Commit Transaction stage, where Salesforce permanently saves all successful changes and explains why rollback is no longer possible after the commit.
Practice What You've Learned
Test your understanding with these practice exercises