How to Define Sharing Rules in Salesforce


Sharing rules enable us to extend sharing access to Users in public groups, territories, or roles. Sharing rules creates automatic exceptions to org-wide default settings for Users who do not own the record.


A business has sales teams both in India and Canada. The same Manager manages the teams, and therefore, due to role hierarchy, the Manager has access to the records owned by both teams.

A scenario comes up where the sales team in India must access records owned by their peers in Canada. But this cannot be implemented via Role Hierarchy as both sales teams come under similar roles. This is where Sharing Rules come into play.

Sharing Rules enable users to share records based on certain conditions. Let’s learn how that works.

Open Access with Sharing Rules

Sharing Rules enable Users to share records that are either public read-only, or private. This is because sharing rules are used to grant additional access.

A public read/write record need not be shared as those records are already entirely accessible by all Users in your org.

Sharing Rules comes in two flavors:

  • Owner-Based Sharing Rules
  • Criteria-Based Sharing Rules

1. Owner-Based Sharing Rules

These sharing rules open access to records based on who owns the record.

Example: The Canada Sales Manager of a business is granted access to the records owned by the U.S. Sales Manager.

2. Criteria–Based Sharing Rules

These sharing rules are based on record values and not the record owners. This rule determines whom to share records with based on the record’s field value.

Example: The Sales Managers in your organization are shared records of the custom object, Job Applications, when the field, Department, has the value, “Sales”.

Create a Public Group

A public group is a compilation of Users that can be defined only by the Administrator. A public group can simplify sharing access via a sharing rule. They can be a combination of:

  • Roles
  • Roles and Subordinates
  • Territories
  • Territories and Subordinates
  • Individual Users
  • Other public groups

Let’s get hands-on and create a public group in our orgs:

1. Open Setup, t Public Groups in the Quick Find Box, and then select Public Groups.

2. Click New.

3. Enter a Label for your group. The Group Name auto-populates.

4. From the Search drop-down list, you can choose either individual users, roles, roles, and subordinates or other public groups. You can add a combination of member types.

5. From the Available Members List, select Users and then click Add.

A picture containing text Description automatically generated

6. Click Save.

Create and Assign a Sharing Rule

1. From Setup, enter Sharing Settings in the Quick Find Box, and then click Sharing Settings (This is where we set up org-wide defaults).

2. From the drop-down list, Manage sharing setting for, and select the object for which you want to create the sharing rule. This is especially useful if you have a large org, and it also enables us to view a complete picture of the org-wide defaults and sharing settings for the object at a glance.

3. Scroll down to find Sharing Rules. Click New.

4. Give the sharing rule a Label. The Rule Name auto-populates.

5. Select your rule type; it can be based on the record owner or based on criteria. We’ll stick with Based on record owner for now.

6. For Select which records to be shared, choose the Public Group you created.

7. Now Select the user to share with.

8. Select the degree of access for the users. It can be either Read Only or Read/Write.

9. Click Save.

That was it. You created a public group and assigned a sharing rule to the group all on your own!



  • Barry Allen

    A Full Stack Developer with 10+ years of experience in different domain including SAP, Blockchain, AI and Web Development.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.