Newer Version Available

This content describes an older version of this product. View Latest

Criteria-Based Sharing Rules

Available in: Salesforce Classic and Lightning Experience
Available in: Professional, Enterprise, Performance, Unlimited, Developer, and Database.com Editions

Accounts, Opportunities, Cases, Contacts, and record types are not available in Database.com


Criteria-based sharing rules determine whom to share records with based on field values in records. For example, let’s say you use a custom object for job applications, with a custom picklist field named “Department.” A criteria-based sharing rule could share all job applications in which the Department field is set to “IT” with all IT managers in your organization.
  • Although criteria-based sharing rules are based on values in the records and not the record owners, a role or territory hierarchy still allows users higher in the hierarchy to access the records.
  • You can’t use Apex to create criteria-based sharing rules. Also, criteria-based sharing cannot be tested using Apex.
  • You can use the SharingRules type in the Metadata API to create criteria-based sharing rules starting in API version 24.0.
  • You can’t include high-volume portal users in sharing rules because they don’t have roles and can’t be in public groups.

Note

You can create criteria-based sharing rules for accounts, opportunities, cases, contacts, leads, campaigns, and custom objects. You can create up to 50 criteria-based sharing rules per object.
  • Record types
  • These field types:
    • Auto Number
    • Checkbox
    • Date
    • Date/Time
    • Email
    • Number
    • Percent
    • Phone
    • Picklist
    • Text
    • Text Area
    • URL
    • Lookup Relationship (to user ID or queue ID)

Text and Text Area are case-sensitive. For example, a criteria-based sharing rule that specifies “Manager” in a text field doesn’t share records that have “manager” in the field. To create a rule with several common cases of a word, enter each value separated by a comma.

Note