You are here:
Create Criteria-Based Sharing Rules
A criteria-based sharing rule determines who to share records with based on field values.
Required Editions
| Available in: both Salesforce Classic and Lightning Experience |
| Available in: Professional, Enterprise, Performance, Unlimited, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To create sharing rules: | Manage Sharing |
For example, you have a custom object for job applications, with a custom picklist field named “Department.” You create a criteria-based sharing rule to share all job applications in which the Department field is set to “IT” with all IT managers in your organization.
- To include public groups in your sharing rule, confirm that those groups were created.
- From Setup, in the Quick Find box, enter Sharing Settings, and then select Sharing Settings.
- In the Sharing Rules related list for the object, click New.
- Enter the label name and rule name. The label name appears on the user interface. The rule name is a unique name used by the API and managed packages.
- Optionally, enter a description of the sharing rule of up to 1,000 characters.
- For the rule type, select Based on criteria.
-
Specify the field, operator, and value criteria that records must match to be included in
the sharing rule. The fields available depend on the object selected, and the value is always a
literal number or string. To change the AND relationship between filters, click Add
Filter Logic. The value criteria is limited to 240 characters, and strings or
picklist values that go beyond this limit are truncated.
Note You can use a field that’s not supported by criteria-based sharing rules. Create a workflow rule or Apex trigger to copy the value of the field into a text or numeric field. Then use that field as the criterion. -
If available, select whether to include records owned by users who can’t have an assigned
role, such as high-volume users and system users. This setting is enabled by default and can’t
be edited after you save the rule.
Note To include these users in criteria-based sharing rules that were created before Spring `22, delete the rule and select Include records owned by users who can't have an assigned role when you recreate it. -
Specify the users who get access to the data. For Share with, select a category from
the first dropdown list and a set of users from the second dropdown list or lookup
field.
Note If you provide record access to external users by selecting the Portal Roles, Portal Roles and Subordinates, or Roles, Internal and Portal Subordinates as a target for the sharing rule category, you get an alert when you save the sharing rule.See Sharing Rule Categories for information on these categories. -
Select sharing access settings for users. Some access settings aren’t available for some
objects or in some situations.
Note Contact Access isn’t available when the organization-wide default for contacts is set to Controlled by Parent. - Save your work.
After updates to sharing rules, sharing rules are recalculated to add or remove access as needed. Depending on the nature of your updates and your org’s setup, these sharing calculations can take a while to complete. If you experience sharing evaluations or timeouts, consider deferring sharing calculations before making large-scale updates, and then restart and recalculate sharing at a later time. For more information, see Defer Sharing Calculations in Salesforce Help.

