Scoping Rules in Salesforce with Example

This post will walk you through the implementation of using Scoping Rules in Salesforce with an example. Scoping Rules in Salesforce are used to control the default records that our users see based on the criteria we select. We can set up the Scoping Rules for different users in your Salesforce org so that the users can focus on the records that matter to them the most.

When should we use Scoping Rules in Salesforce?

We should use Scoping Rules in Salesforce to control the records that your users see by default. But note that, Scoping Rules do not restrict the user’s access to other records they sometimes need. The user can still open and report on all the records that they have access to as per the organization’s Sharing Settings.

Scoping Rules in Salesforce
Scoping Rules in Salesforce

How to create Scoping Rules?

Follow the below steps to create a Scoping Rule in Salesforce with an example:

First, go to Setup -> Object Manager -> Click on the Object Name for which you want to create a Scoping Rule.

Click on Scoping Rules from the left panel and then, click on New Rule.

Provide the Rule Name, Description, etc.

Then, we need to specify the User Criteria based on either one of the below Criteria Types:

  • User Criteria: Uses fields of current user record to determine if the Rule will be applicable.
  • Permission Criteria: Uses the selected Custom Permission to determine if the Rule is applicable.

Finally, we need to provide the Record Criteria which will be used to filter the records. The records that matched the filter criteria will be considered as the default records for that particular object, for those particular users who match the User Criteria.

Below is the sample Scoping Rule in Salesforce that I created for the demonstration of this implementation:

Sample Scoping Rule in Salesforce to scope Active Records
Sample Scoping Rule in Salesforce to scope Active Records

Based on this rule, if the current User has a Nickname as nikstest, the active Subscribe records will be considered as the default record for the current user.

Below is the list of All records which are visible after creating a Scoping Rule:

All Subscriber Records
All Subscriber Records

And below are the records that are displayed while searching for the Subscriber records from the Global Search.

Scoped Records from Global Search
Scoped Records from Global Search

Also Read:

Due to our Scoping Rule, only Active Subscribers are displayed in the search result, as those records act as a default record. But the user can still see all the records from the All List View for the Subscriber object as shown in the earlier screenshot.

Which Objects are available?

Scoping Rules in Salesforce are only available for:

  • Custom Objects
  • Account
  • Case
  • Contact
  • Event
  • Lead
  • Opportunity
  • Task Standard Objects

Scoping Rules are applied only to the following Salesforce features:

  • List Views (only if Filter by Scope is selected)
  • Reports (only if Filter by Scope is selected)
  • Lookups
  • Search
  • SOQL (Applicable unless scope other than scopingrule is specified)
  • SOSL (Applied, except for USING ListView= clause)

If you don’t want to miss new implementations, please Subscribe here.

That is all from this post. I recommend checking the official Salesforce documentation about the considerations while using Scoping Rules in Salesforce with an example here.

If you want to check more standard implementation in Salesforce, you can check it here.

Leave a Comment