Meet Salesforce ‘Scoping Rules’, the sister of the (similarly named) ‘Restriction Rules’. Scoping rules are intended to help users by showing the records they need access to and hiding less important records, therefore reducing the ‘scope’ of what a user sees.
In this article, we’ll explore how scoping rules work, where they apply, and any other considerations you need to be aware of before setting them up.
What Are Salesforce Scoping Rules?
In simple terms, these rules “let you control the default records that your users see based on criteria that you select” – this is a very useful feature for keeping records that matter in the right place for the right people.
For further updates, it’s worth checking in with the Trailblazer community, as well as the Scoping Rules Developer Guide.
Where Do Scoping Rules Apply?
Scoping Rules apply to Account, Case, Contact, Lead, Event, Task, Opportunity and Custom Objects.
If you’ve been in the ecosystem for a while, you may have heard of a Classic feature called Divisions.
Scoping Rules are a Lightning Experience version of this feature, that allow a user to toggle a filter on records that are currently important to them.
For example, in the morning users may want to focus on EU Accounts, and in the afternoon they want to focus on US Accounts.
Using the power of Flow, a user can update their preference from a “clicks not code” interface, applying a ‘lens’ to filter the records they see.
This lens applies to:
- List Views (when Filter by Scope is selected)
- Reports (when Filter by Scope is selected)
- SOQL (using Scope ScopingRule)
How Do I Create Scoping Rules?
To create scoping rules, you need specific permissions for “Manage Sharing”, “View Setup & Configuration”, and “View Restriction and Scoping Rules”.
Unfortunately, there is no interface to manage these right now, so you need to configure or amend using the Metadata or Tooling API.
This means that a developer can use tools such as Visual Studio Code to get started, which can then be supported by a flow built either by the same developer or an admin.
Considerations When Using Scoping Rules
As a powerful feature that makes troubleshooting more complex, Salesforce have limited this feature to customers with Signature or Premier Priority Support, or services that specifically involve a Technical Account Manager, Program Architect, or Implementation Architect.
As well as meeting the ‘support’ requirements for scoping rules, you also have to be running either Salesforce Performance or Unlimited Edition.
There is not currently a user interface to manage these rules, and only certain fields are supported, namely:
- Checkbox
- Date
- Date time
- Number
- Lookup
- Text
- Time
- Picklist
It’s also important to know that scoping rules can impact your duplicate rules, by restricting the records users can see. In addition, scoping rules don’t support Person Account fields.
You can currently have two rules per object in Developer Edition, and up to five rules in Performance and Unlimited.
Summary
There are plenty of important considerations to take into account when setting up and using Salesforce Scoping Rules. Whether you are a Salesforce Developer or an Admin, this product feature demo is a great place to start.