How to Create Restriction Rules in Salesforce

In Salesforce, restriction rules are used to enhance org security by allowing certain users to access particular records. After applying the restriction rule, the user can access only data that matches the criteria you specified.

The Restriction Rules are only available in Salesforce Lightning.

In this tutorial, we are going to learn about Restriction Rules in Salesforce, what is restriction rules, when we can use them, what are the uses of restriction rules, and what are the uses of restriction rules.

Additionally, we will see step-by-step how to create restriction rules in Salesforce Lightning.

Restriction Rules in Salesforce

What is the restriction rule in Salesforce?

When the restriction rule applies to the user, then he can see only those records that the user is granted via OWD(Organization Wide-Default), sharing rule, and other sharing mechanisms are filtered by criteria that you specified.

We can set restriction rules on Contacts, Tasks, Events, Custom Objects, and External Objects. We can create up to two restriction rules active per object in Developer and Enterprise editions and up to five restriction rules active per object in Performance and Unlimited editions.

When can we use restriction rules in Salesforce?

When we want certain users to see a specific set of records, the restriction rule simplifies controlling access to records with confidential or important information. Restriction rules are applied to the List view, Reports, Lookup, Related List, Search, SOSL, and SOQL Salesforce features.

What are the uses of restriction rules in Salesforce?

The following are the uses of restriction rules –

  • We can filter the records based on the User and Record criteria so the user can see only the data to which he has access.
  • After applying the restriction rule, the user can access only data that matches the criteria you specified.
  • It enhances organization security and records security by allowing certain users to access specific records.
See also  How to Restrict Login IP Addresses in Profiles in Salesforce

How does the restriction rule affect other sharing settings?

In Salesforce, the user gets access record-level access from the organization-wide defaults and other sharing settings. When the restriction rule is applied to a user, the records they had access to from the sharing settings are further scoped to only records matching the record criteria.

Eg. Some user has read-only access via sharing settings, and then we applied a restriction rule with record criteria. Then, users can read only those records according to the defined record criteria.

How to Create Restriction Rules in Salesforce

Using the following steps, we can create a restriction rule.

1. First login to Salesforce org, and you will see the Home page, on top of the screen you can see the navigation bar. Click on the Object Manager tab. After clicking on object manager, all objects will be displayed on the screen.

In the search box, you can search for the object name on which you want to create the restriction rule. Here, I have selected Custom Account Object.

Create restriction rule in Salesforce

2. After clicking on the selected object, you will see on the left side some option will display scroll down, and you will find the Restriction Rule option. Click on the Restriction Rule option.

How to create restriction rule in Salesforce

3. As you click on the restriction rule this window will appear, here you can see they already provided some information about the restriction rule. and bottom of the screen you can see the Create new Rule button, click on that button.

Apply restriction rule in Salesforce

4. Now, from here, we will start to set rules for the account object.

  • Rule Name: In this field, you need to enter your rule name. Here, I have set my rule name as Account priority.
  • Full Name: This is an API name, when you click on that field it will populate automatically. In the Description, you can enter information about a rule or you can leave it blank, it is optional.
  • To Activate the rule you need to click on the Is Active checkbox, you can deactivate it also.
Use of restriction rule in Salesforce

5. After entering rule detail information, you will see User Criteria.

  • User Criteria – In the user criteria, you can select users that you want to restrict records from them.
  • Field: In this field, you can select a user name, active user, alias, user ID, etc. It depends upon you. Here, I have selected a Username.
  • Operator: In this, we will select Equals Operator.
  • Type: The Type field depends upon the Field where we select the user; it can be String, Picklist, or Current User.
  • Value: Select the Value. Here, I have selected a username that we can get from user details.
See also  How to Assign Permission Sets to Users in Salesforce

Now, we can say that we have selected a user whose username is alexanderson123@gmail.com. Now, this user will not access records, which we will define criteria for records.

Add restriction rule in Salesforce

6. Next, we need to enter Record Criteria.

  • Record Criteria – In the record criteria, you can add a condition that we can select based on which field and value we want to restrict records.
  • Field: In this field, you can select a field that is present in the same object. Here, I have selected an Account Priority.
  • Operator: In this, we will select Equals Operator.
  • Type: The Type field depends upon the Field where we select the user; it can be String, Picklist, or Current User. Here, my selected field is picklist, so the type is also picklist.
  • Value: Select the Value. Here, I have selected a High value from the picklist.

Then click on the Save button to save the restriction rule.

In the user criteria, we have defined which users who come under that criteria will not be able to access the records that we defined in the records criteria.

How to apply restriction rule in Salesforce

7. Here, we can see our Account Priority restriction rule has been saved.

Restriction rule in Salesforce

This is how we can create the restriction rule in Salesforce Lightning.

Conclusion

I hope you have got an idea about restriction rules in Salesforce, what is restriction rules, when we can use them, What are the uses of restriction rules, and what are the uses of restriction rules. Additionally, we also have seen step-by-step how to create restriction rules in Salesforce Lightning.

See also  How to View Record Pages Assignments in Salesforce

You may like to read: