![](https://gokulrajan.com/wp-content/uploads/2023/01/RestrictionRule.jpg)
Restriction Rules
Restriction Rules prevent users from accessing records that can contain sensitive data or information that isn’t essential to their work. Restriction rules filter the records that a user has access to so that they can access only the records that match the criteria you specify.
Restriction rules are available in :
- custom objects
- external objects
- contracts
- Tasks and Events
2 active Restriction rules per object in Enterprise and Developer editions .
5 active Restriction rules per object in Performance and Unlimited editions.
Create a Restriction Rule
- go to Setup –> Object Manager –> Select the Object you want to create Restriction Rule
![](https://gokulrajan.com/wp-content/uploads/2023/01/Setup.png)
2.Create New Rule
![](https://gokulrajan.com/wp-content/uploads/2023/01/CreateRR-1024x466.png)
3.Enter the rule’s name and full name. The full name is the name of the component used by the API.
4. To have the rule take effect upon saving, select Active.
![](https://gokulrajan.com/wp-content/uploads/2023/01/NewRR-1-1024x533.png)
5.Save the rule.
Restriction Rule Considerations
- Restriction rules support custom picklist values in record and user criteria. If you delete a custom picklist value used in a restriction rule, the rule no longer works as intended.
- Restriction rules aren’t applied for code executed in System Mode.
- Create only one restriction or scoping rule per object per user. In other words, for a given object, only one restriction or scoping rule at most can have the User Criteria field evaluate to
true
for a given user. - Creating a restriction rule for an object doesn’t automatically restrict access to its child objects.
- The use of AND and OR operators isn’t supported.
- The use of formulas isn’t supported.
- You can use a change set or unlocked package to move restriction rules from one org to another.
Deployment
Using Metadata
<types>
<members>*</members>
<name>RestrictionRule</name>
</types>
Package.xml