Sharing Rules in Salesforce

One of the most popular customer relationship management (CRM) tools is Salesforce. Businesses have altered how they interact with customers in order to create ties that last, quickly detect their requirements and solve issues, and deploy apps. We'll focus on Salesforce's sharing rules in this article.

Since there is a lot of data that is shared in businesses and needs to be, there are many components of Salesforce that take data security into account. A collection of rules, namely the sharing rules in Salesforce, perform a check and control on this data sharing, which is necessary.

Table of Content - Sharing Rules in Salesforce

Define a Sharing Rule

Take into account a situation where a manager is in charge of two teams: the marketing team in India and the marketing team in the USA. Using the role hierarchy mechanism, the manager can now access the records of both teams, but what if the marketing team in the USA wishes to access the records of the marketing team in India? Due to the fact that both teams are at the peer level, this cannot be accomplished using the role hierarchy method. This is where Salesforce's sharing rules play a crucial role.

Users can share records based on criteria with the aid of sharing rules. Since sharing rules may only expand access and not restrict it, it is essentially generated for objects whose organization-wide defaults (OWD) are set to public read-only or private.

There is no need to set a sharing rule if OWD is already public (read/write).

For a single position, area, or open group, a sharing rule can be established. A role, region, and its subordinates can all have their own sharing rules established.

  • Use the Quick Find box in Setup to locate Sharing Settings. The organization-wide defaults are defined on the same page.
  • Select the object for which to build the sharing rule under Manage sharing settings.
  • Click New and give the rule a name in the Sharing Rules section. The Rule Name text box immediately fills in after being clicked.
  • Select the owner-based or criteria-based sharing rule as the rule type. The Based on record owner sharing rule can be chosen here.
  • For Choose which records should be shared, then choose a category and a group of users from the second drop-down list or lookup field.
  • Indicate the users who should have access to the data under Select people to share with.
  • Choose a sharing access configuration.
  • Press Save.
Do you want to get certified and build your career in Salesforce? Then enroll in "Online Salesforce Certification Trainingthis course will help you to achieve excellence in this domain.

Types of Sharing Rules in Salesforce

Based on which records should be shared, Salesforce primarily has two types of sharing rules:

  • Owner-based Sharing Rules
  • Criteria-based Sharing Rules

1. Owner-based Sharing Rules

When we wish to share records that are owned by a specific group of users or a single user with another group of users, we use owner-based sharing rules in Salesforce. For instance, the owner-based sharing rule is used to access the records shared by the US-based office if a multinational corporation (MNC) needs to access the sales record of their US-based office from India.

2. Criteria-based Sharing Rules

When we wish to share records in Salesforce that meet specific criteria or satisfy a specific condition, we utilize criteria-based sharing rules. As an illustration, a bank manager requests to see the details of every savings account. In such a scenario, a filter will be added to the sharing rules specifying that a specific account will only be shared with the manager if it falls under the category of savings accounts.

Why do Salesforce need Sharing Rules?

To limit and manage access to data for particular users or groups of users, Salesforce requires sharing rules. Administrators can grant users who do not automatically have access to particular documents or data, such as those in a separate department or group, access through sharing rules.

Salesforce provides a flexible security framework that can be tailored to a company's particular requirements. Sharing rules, a crucial component of this security architecture, can be used to grant users regulated, secure access to data. Users' access to data can be expanded by using sharing rules based on specified criteria, such as a region or product line.

Let's imagine, for instance, that your marketing team does not require access to the same customer details as your sales team, despite the fact that the sales team does. By setting up a sharing rule, you can make sure that only the sales team has access to client details that meet certain requirements while keeping the marketing team out. This maintains the overall security of the system while ensuring that each user or group of users can only access the data they require to perform their duties.

Overall, Salesforce needs sharing rules to make sure that only authorized users can access data, keep the data secure, and maintain it compliant with security and privacy laws.

Would you like to ace Salesforce job interviews? Top Salesforce Interview Questions from MindMajix are exclusively for you! 

Steps to Create Sharing Rules

Let's examine the sharing rule deployment process in a Salesforce dashboard:

Step 1: Open Sharing Settings by selecting it from the Quick Find menu.

Step 1

Step 2: Once you've located the specific object where a sharing rule needs to be created by scrolling down, select New to add a new sharing rule.

Step 2

Step 3:  Add a label for the sharing restriction you want to implement.

Step 3

Step 4: Decide whether you want to construct an owner-based or criteria-based sharing rule.

Step 4

Step 5: Add the specific criteria to match the requirements of the sharing rule if you have chosen to pick data based on criteria.

Step 5

Step 6: From the table, choose which records should be shared.

Step 6

Step 7: Decide which users the records should be shared with.

Step 8: When finished, choose the degree of access to be granted and click Save.

Step 8

Your sharing rule has been established.

sharing rule established

Salesforce Sharing Rules Components

A sharing rule in Salesforce is made up of the following three elements:

1. Share which records?

The types of record ownership-based sharing regulations that apply or whether a record meets the specified requirements on a record decide this. The records that must be shared with a certain group of users must be determined by the Salesforce administrators. The administrators must determine whether a specific owner must share the records or whether only the records that satisfy certain requirements must be shared.

2. With which users?

We now know which records must be shared, so the next step is to decide who should receive which records. Are these user groups based on user roles, user territories, or user communities? Keep in mind that administrators can combine any of the following when creating public groups:

  • Other public groups
  • Territories and subordinates
  • Roles
  • Individual users
  • Territories
  • Roles and subordinates

3. What kind of access?

Either read-only or read/write access is given. Depending on the work that needs to be done on the records, we must grant access to the users. The administrator grants the necessary access, whether it is read-only access for the general public or edit access.

When Should You Use Salesforce Sharing Rules?

Using two examples based on the chosen category, we will talk about specific use cases for sharing rules in Salesforce:

  • Use Case of Record Ownership-based Sharing Rule

Ownership-based Sharing Rule

Consider a huge department that has been divided into a number of smaller sub-departments, each serving one or more product lines. While assigned to various managers in the role hierarchy, the teams ought to be able to view some of each other's records, such as opportunities or cases.

Customer Support Team A may be permitted to examine the records owned by Customer Support Team B in this scenario using the record ownership-based sharing rule, and vice versa.

  • Criteria-based Sharing Rule Use Case

Leads are often privately held records by default. They should occasionally be reachable by other employees of a corporation. Let's take the case of a salesperson who interacted with a prospective customer who wasn't quite ready to make a purchase. The status of the lead is changed to "Unqualified."

The customer must be persuaded to buy in this circumstance. It makes sense to employ marketing experts at this point and permit the examination of such "Unqualified" leads. In this manner, the sharing rule will only allow the marketing specialists to view and interact with the required leads.

Limitations of Sharing Rules in Salesforce

  • Sharing restrictions merely give other users more access.
  • Regardless of whether a user is active or not, access is provided through sharing rules.
  • Every time a user or role is changed, sharing rules are always reevaluated.
  • Sharing rules provide users access to any records connected to the specific record as well, which might result in the loss of data integrity.

MindMajix Youtube Channel

Define a Public Group

A public group is a collection of distinct users, distinct roles, distinct groups, distinct roles with subordinates, and/or distinct roles with their own subordinates. Everyone in the firm can use it, but only administrators can build it.

Assigning items or resources that are meant to be seen or used by everyone in the organization is the goal of public groups. Time and effort are greatly reduced by public groups.

If a sharing rule that applies to more than one or two groups, roles, or any particular person needs to be defined, the procedures for creating a public group are as follows:

  • Use the Quick Find box in Setup to look for Public Groups.
  • Select New.
  • Identify your group. The Group Name text field populates itself when you click it. The managed packages and API both use this specific name.
  • From the Search drop-down menu, choose the individual users, additional groups, or positions, as well as if their subordinates are included. Public groups may have a variety of distinct members kinds.
  • Users can be chosen from the list of Available Members by clicking Add.
  • Press Save.

Sharing guidelines can be established once the group has been established.

Security in Salesforce

Let's examine how Salesforce handles data security presently. In Salesforce, security may be provided in four different ways:

Sharing RulesRead / WriteFor  roles, groups or subs and roles on a condition basis
Manual SharingRead / WriteFor any user or queue manually
Role HierarchyRead / WriteFor sub-roles and manager
OWDRead / WriteDefault for all

The list of methods and tasks that can be done is provided above. In Salesforce, profiles are essentially users who have access to the data.

Sharing Rules in Salesforce FAQs

1. What are the types of sharing rules in Salesforce?

Based on which records should be shared, Salesforce offers two different types of sharing rules:

  • Owner Based: Owner Based shares the records that certain users have access to. Owners can be located via subordinates, public groups, and roles and roles.
  • Criteria-Based: Records that meet specific criteria are shared using a criteria-based search.

2. What is the use of sharing rules in Salesforce?

Users can share records based on criteria with the aid of sharing rules. Since sharing rules may only expand access and not restrict it, it is essentially generated for objects whose organization-wide defaults (OWD) are set to public read-only or private.

3. What are sharing rules and OWD in Salesforce?

OWD imposes limitations, and other systems permit access. Salesforce offers a feature called Sharing Rules to grant this access. Records can be shared with users who don't have access to them using sharing rules. Users in open groups, roles, or territories are given access according to sharing rules.

4. What is the difference between sharing rules and permission sets?

It's similar to expanding a profile to create a permission set. A permission set with create/read/write on an object will only allow the user to create and manage their own records, not records held by other users, if the organization-wide sharing rules for that object are set to private.

5. What are the steps involved in sharing rules?

In order to build a sharing rule in Salesforce, you must first describe the criteria for the rule, identify the users or groups with whom to share records, choose the access level, construct the sharing rule, test it, and then keep an eye on its efficacy.

6. How many sharing rules per object?

If an object has criteria-based or guest user sharing rules available, you can define up to 50 of those for each object, for a total of 300 sharing rules in total. These forms of sharing regulations can be established. Other items in your org might be subject to sharing rules.

7. How do I deploy sharing rules in Salesforce?

Using the Change Set or Metadata API, you can test a sharing rule in a sandbox or development environment before deploying it to your production environment in Salesforce. Verify that it has been appropriately deployed and is operating as expected in the production environment before concluding.

8. Which object Cannot have sharing rules in Salesforce?

It is not possible to include sharing rules in a package or utilize them to support sharing logic for programmes downloaded through the AppExchange. Record ownership or other factors may be used to determine sharing restrictions. The creation of criteria-based sharing rules is not possible with Apex. Apex cannot be used to evaluate criteria-based sharing.

9. Who can create sharing rules in Salesforce?

You can establish sharing rules that allow guests who are not authenticated to view records based on the record owner or other criteria. For the User object, you can additionally establish sharing policies based on group membership.

10. What is the difference between sharing rules and manual sharing in Salesforce?

Records can be shared with users who don't have access to them using sharing rules. Users in open groups, roles, or territories are given access according to sharing rules. They give people who are now unable to view the records because of OWD settings increased access. A record may be shared in a number of ways.

11. Does sharing rules override the profile?

The privileges offered by Sharing Rules at the user level are superseded by profiles. For instance, you cannot allow Write permission in Sharing Rules if Profiles do not grant Edit permission.


Sharing rules are a very effective approach to keep Salesforce's data accurate, but keep in mind that they can only give other users access; they cannot grant them restricted access. It offers read-only or read/write access because of this. It functions well in businesses that forbid frequent modifications to their user list. you can also enroll in "Online Salesforce Certification Training" and get a certification.

Course Schedule
Salesforce TrainingJul 27 to Aug 11View Details
Salesforce TrainingJul 30 to Aug 14View Details
Salesforce TrainingAug 03 to Aug 18View Details
Salesforce TrainingAug 06 to Aug 21View Details
Last updated: 05 Jun 2023
About Author


Madhuri is a Senior Content Creator at MindMajix. She has written about a range of different topics on various technologies, which include, Splunk, Tensorflow, Selenium, and CEH. She spends most of her time researching on technology, and startups. Connect with her via LinkedIn and Twitter .

read less
  1. Share:
Salesforce Articles