How to Setup Criteria-Based Sharing Rules in Salesforce

In this Salesforce tutorial, we will learn to set up criteria-based sharing rules in the Salesforce organization. We can set criteria-based sharing rules in Salesforce Lightning and Salesforce Classic.

Criteria-Based Sharing Rules in Salesforce

In Salesforce, criteria-based sharing rules, specifically, are a type of sharing rule that is defined by criteria rather than specifying individual users or roles. This rule is used to automate the sharing of records with specific users or groups based on certain conditions or criteria.

Criteria-based sharing rules are particularly useful for ensuring that relevant records are visible to the right people. This helps in collaboration and ensures that users can access the information they need to perform their roles effectively.

Setup Criteria-Based Sharing Rules in Salesforce Lightning

To set criteria-based Sharing Rules in Salesforce Lightning, navigate to the Setup page of Salesforce Lightning then follow the below steps.

1. On the Setup page of Salesforce Lightning, go to the Quick Find box and search, then select Sharing Settings.

Setup criteria based sharing in Salesforce

2. In the Setup window Sharing Settings, scroll down to the section Sharing Rules. Then, in the Sharing Rules related list, select the object and click on the New button.

In this example, I have selected Lead Sharing Rules to set up criteria-based sharing rules.

Salesforce Lightning setup criteria based sharing

3. In the setup of the Lead Sharing Rule, go to the section Rule Name and here enter the Label field. In this example, I have entered the Label as Lead Transfer rule.

The Rule Name will be auto-filled as API according to the entered Label.

Setup Criteria based Sharing for object in Salesforce

4. In the field Select your type, choose the option Based on criteria.

Salesforce Lightning setup criteria based sharing rule

5. In this step, we will define the criteria for sharing, and for that, go to the Criteria section and specify the Field, Operator, and Value.

See also  Schema Builder in Salesforce

In this example, I have applied the criteria for the fields of City, Country, and Industry.

After specifying the criteria, click on Add Filter Logic.

Salesforce Lightning Specify criteria for Sharing rules

8. In the Filter Logic enter each filter line number, which is separated by a filter logic operator like AND, OR.

For example, (1 AND 2) OR 3  finds records that match both Filter 1 and Filter 2 or Filter 3.

In this scenario, I have defined the logic as 1 AND 2 AND 3.

Setup Criteria based Sharing for object in Salesforce Lightning

9. Specify the users who get access to the data. In the field Share with, select a category from the first dropdown list and a set of users from the second dropdown list.

In this example, I have selected the Category as Roles and Subordinates then Set of users as Marketing Team.

Select users to setup criteria based sharing rules

10. In this step, select the level of access for the users. In this case, I have selected the access as Read/Write. At last, click on the Save button.

Create Criteria based Sharing rules in Salesforce

11. As we click on the Save button, a confirmation message will appear on the screen; click on the OK button.

Create Criteria based Sharing rules in Salesforce Lightning

Now the criteria-based sharing rule will be created in the Object’s sharing rules section. In this example, I have specified the Sharing rule in the Leads object so the rule will be visible in the Lead Sharing Rules.

Criteria based Sharing Rule in Salesforce Lightning

As we can see in the above image, the sharing rule is created in the leads object with the defined criteria.

In this way, we can set up Criteria-Based Sharing Rules in Salesforce Lighting by following the above steps.

Setup Criteria-Based Sharing Rules in Salesforce Classic

To set up a Criteria-Based Sharing Rule in Salesforce Classic, first switch to the Salesforce Classic edition then follow the below steps.

1. On the Home page of Salesforce Classic, click on the Setup tab.

See also  How to Create Custom Big Objects in Salesforce

2. In the Setup page of Salesforce Classic, go to the Quick Find box in the left sidebar and search, then select Sharing settings.

Salesforce Classic setup criteria based sharing rule

3. In the Sharing Settings setup window, scroll down to the section Sharing Rules and click on the New button of the object in which you have to define the criteria-based sharing rule.

In this example, I have selected the Case object to set up a criteria-based sharing rule.

4. In the setup window of the object’s sharing rule, enter the name for the sharing rule in the Label field. In this example, I have entered the label as Case Transfer Rule.

Create Criteria based Sharing rules in Salesforce Classic

The API name field Rule Name will be auto-filled according to the entered Label field.

5. In the Rule Type field, select the option Based on Criteria.

Setup Sharing Rules Based on Criteria in Salesforce

6. Go to the Criteria section and enter the Field, Operator, and Values to specify the criteria for sharing the records.

In this example, I have specified the Criteria for the fields Due Date, Case Origin, and Priority.

By default, we have the AND operator as filter logic between the specified criteria. To change the logic filter to the defined criteria, click on Add Filter Logic.

Salesforce Classic specify Criteria for Sharing rule

7. In this step, to add the filter logic, select the operators between each filter line.

For example, I have entered the filter logic as 1 OR 2 OR 3 which means if any of the three filter conditions is true, the record will be eligible for sharing or transfer.

Apply filters to Criteria based Sharing rules in Salesforce

8. In the field Share With, we have to specify the users who can access the data and, for that, select a category from the first dropdown list and a set of users from the second dropdown list.

In this case, I have selected the category Roles and User as SVP, Sales & Marketing.

Select users to setup criteria based sharing rules in Salesforce

9. In the field Case access, select the access type for the user. In this example, I have selected the access as Read/Write.

See also  How to create free Salesforce Developer edition account

At last, click on the Save button.

Salesforce Classic Create Criteria based sharing rule

10. As we click on the Save button, a confirmation message to create a sharing rule will appear on the screen, and there, click on the OK button for confirmation.

Salesforce Classic setup criteria based sharing rule for object

Now, the Sharing Rule that we have created by specifying the criteria in the filters will be created, and to view the created criteria-based sharing rule, go to the Sharing Settings window, and then in the section Sharing Rules of the selected object, we can see the created sharing rule.

Setup Sharing Rules Based on Criteria in Salesforce Classic

Now, we have successfully set a criteria-based sharing rule for the Case object in Salesforce Classic, and you can follow the same procedure to set a criteria-based sharing rule for any other object.

Conclusion

In this Salesforce tutorial, we have learned to set up criteria-based sharing rules in Salesforce Lightning and Salesforce Classic with the help of the above examples, where we specified the records-sharing criteria with the help of filters.

Along with this, we also learned about what are criteria based sharing rules and their use in Salesforce.

You may like to read: