In this chapter, we will discuss how to define sharing rules in Salesforce. Though we can manage the access to different objects and records through organization-wide settings and role hierarchies, we come across situations wherein, exceptions are required. We need to grant access to specific data to specific users who are not able to access the required data because of their roles. For example, to see the case history when a user has only access to the current case details. In such scenarios, we take help of sharing rules. Through this mechanism, we create a public group which will accommodate all the users who need such exception and then add sharing rules to such a group.
In this section, we will discuss the steps to create sharing rules. The steps are described below
Create a public group which will have the users who need specific access. Go to the link path, Setup home → Users → Public Groups → New Group. We need to fill the required details. Also choose the group of users who will need to use the sharing rules. Keep the Grant access using Hierarchies checked so that the other users listed below in this hierarchy can inherit the access. Click Save.
Now we create the sharing rule for the above public group. Go to the link path Setup Home → Security → Sharing settings. From the dropdown of Manage Sharing settings for, choose Campaigns.
Then under Campaign sharing rules, click on the button New. Provide the details for the new sharing rule as shown below. We select a criteria to give access to records for which the value of the field Campaign name is camp_x.
So now all the users under the newly created public group will get access to those records of campaign object where the campaign name is camp_x.