How to Create Sharing Rules in Salesforce
When you want to share a record with multiple users who are connected by horizontal hierarchy, then we use Sharing rules. Sharing rules are only used to extend the access provided based on the permission given by the record owner. They cannot restrict the access provided by OWD or Role hierarchy. Record access can be granted to public groups, roles, roles & subordinates and portal roles based on the permission provided by the record owner.
Components of Sharing Rules:
Every sharing rule has three components-
1. Share which Records:
A record can be shared based on the ownership of a record or meeting certain criteria. We can only share the records of a particular user with other users. We can also share a record based on a field value in the record.
2. With which User:
A public group can be created to simplify sharing rule creation. A public group can be a combination of individual users, roles, roles & subordinates, other public groups that all have common functions.
3. What kind of Access:
We can provide access based on the requirement. It can be Read-only or Read and write access.
I’m creating a sharing rule to provide access to a Public Group
Steps to create Sharing Rule:
Create a public Group with the users who require similar access.
Steps to Create a Public Group
1. Navigate to Setup -> Administer -> Manage Users -> Public Groups
2. Click on ‘New’ Button. You’ll be navigated to the below screen
3. Provide Label, I’m giving as ‘Group1’.
4. In the search pick list, you have to select the type of users whom you want to add to the public group.
5. Here, I’ve selected ‘Users’. The list of existing users is shown in the Available Members as given above.
6. As I’m using developer edition, there are only a few users. Select the users you want to add to the public group and click on Save button. I’ve selected 3 users from the above list and clicked on ‘Save’ button.7. Now, a new public group is created with the name ’Group1’.
Steps to Create Sharing Rule
1. Navigate to Setup -> Security Controls -> Sharing Settings. Below screen will be shown.
2. There you can find a picklist ‘Manage Sharing Settings for’, which contains the list of objects existing in Salesforce.
3. Select an object from the picklist. I’ve selected the ‘Accounts’ object. After selecting the object, you’ll be navigated to below screen.
4. Click on the ‘New’ button. You’ll be navigated to below screen where you need to provide the details of sharing rule
5. In step 1, I’ve given the Name as ‘Account Sharing Rule1’.
6. In step 2, select the type of rule. Here, we need to select the criteria based on which we need to share the record. I’m selecting the rule as ‘Based on Record Owner’.
7. In step 3, select the members whose records need to be shared. It’s a picklist which contains the group of users.
8. I’ve selected ‘Role’ then the list of roles will be displayed in the picklist next to this picklist. I’ve selected ‘VP Human Resources’.
9. In step 4, select the users with whom you want to share the records. I’m selecting the public group ‘Group1’ which is created above.
10. In step 5, select the level of access for the users selected in step5. You can give Read only/ Read/Write access on ‘Default Account and Contract Access’. You can give Private/Read-only/Read/Write on ‘Opportunity and Case’ objects.
11. Provide the required access and click on the ‘Save’ button. You’ll be navigated to below screen.
12. In the above screen, you can see the sharing rule which is created in the above steps.
Salesforce doesn’t allow the creation of sharing rules on all objects. Below table shows the objects on which sharing rules are allowed:
|Professional||Account, asset, contact and Record types|
|Enterprise||Account territory, case, lead, opportunity, order, Campaign, Record types, and custom object sharing rules|
|Performance||Account territory, case, lead, opportunity, order, Campaign, Record types, and custom object sharing rules|
|Unlimited||Account territory, case, lead, opportunity, order, Campaign, Record types, and custom object sharing rules|
- Sharing rules are only used to grant wider access to data.
- The user can access related records automatically with sharing rules.
- Sharing rules are applied to all users, irrespective of their status ie. Active or Inactive.
- Sharing rules are reevaluated every time there is a change in users of the role/group or territory
- As high-volume portal users don’t have roles, they can’t be included in Sharing Rules.
- If a user has different levels of access to a record, the user will get the extended access to the record.
Now, you can easily integrate your Salesforce CRM with the back-end ERP system to automate the business process!