---
schema_version: "1"
id: 167318773ad2b3f1dfbdaf70d244cd44c41d1d9c6eeaccd6f5418ad39ce131ca
title: Restriction Rule Example Scenarios
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/security_restriction_rule_examples.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.security_restriction_rule_examples.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 5afd220fd738e6632e438f4ce8624169055ddc4da6934e36dd1a2596918c577e
description: Refer to these sample restriction rules, which fulfill different access requirements.
products:
  - Security
  - Salesforce Platform
release: "264"
---
# Restriction Rule Example Scenarios

Refer to these sample restriction rules, which fulfill different access requirements.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

To implement these examples, navigate to a supported object in the Object Manager and click **Restriction Rules**.

## Allow Users to See Only Specified Record Type

This restriction rule allows the designated users to see only the records that have a specified record type.

     
| Criteria | Click Path | Field | Operator | Type | Value |
| --- | --- | --- | --- | --- | --- |
| User Criteria | **User** | **Role ID** | \[$User\].UserRoleId | Equals | ID | 00Exxxxxxxxxxxx |
| Record Criteria | **Object** | **Record Type ID** | **Name** | \[Object\].RecordType.Name | Equals | String | Sample Record Type Name |

## Allow Users to See Only Records That They Own

This restriction rule allows users with the designated profile to see only the tasks that they own.

     
| Criteria | Click Path | Field | Operator | Type | Value |
| --- | --- | --- | --- | --- | --- |
| User Criteria | **User** | **Profile ID** | \[$User\].ProfileId | Equals | ID | 00exxxxxxxxxxxx |
| Record Criteria | **Task** | **Assigned To ID (User)User ID** | \[Task\].Owner:User.Id | Equals | Current User | $User.Id |

## Allow Users to See Only Records Owned by Same Role

This restriction rule allows active users to see only the events owned by users that have the same role.

     
| Criteria | Click Path | Field | Operator | Type | Value |
| --- | --- | --- | --- | --- | --- |
| User Criteria | **User** | **Active** | \[$User\].IsActive | Equals | Boolean | True |
| Record Criteria | **Event** | **Assigned To ID (User)Role ID** | \[Event\].Owner:User.UserRoleId | Equals | Current User | $User.UserRoleId |

## Allow Users to See Only Records Owned by Same Profile

This restriction rule allows active users to see only the events owned by users that have the same profile.

     
| Criteria | Click Path | Field | Operator | Type | Value |
| --- | --- | --- | --- | --- | --- |
| User Criteria | **User** | **Active** | \[$User\].IsActive | Equals | Boolean | True |
| Record Criteria | **Event** | **Assigned To ID (User)Profile ID** | \[Event\].Owner:User.ProfileId | Equals | Current User | $User.ProfileId |

## Allow Users to See Records Based on a Custom Field

This restriction rule allows high-volume users to see only the contracts where the user's department matches the contract's department. This rule uses a custom field, Department\_\_c that must have the appropriate value set through Apex, Process Builder, workflows, or flows.

     
| Criteria | Click Path | Field | Operator | Type | Value |
| --- | --- | --- | --- | --- | --- |
| User Criteria | **User** | **User Type** | \[$User\].UserType | Equals | Picklist | High Volume Portal |
| Record Criteria | **Contract** | **Department** | \[Contract\].Department\_\_c | Equals | Current User | $User.Department |

## Allow Users to See an External Object's Records

This restriction rule allows active Salesforce users to see the records of an external object called Purchase Order. The rule uses a field called IsClosed on Purchase Order records in its record criteria.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-access-264-0-0-production-enus/a92be132-3cbc-412a-9262-130636120c14/images/icon_note.png)

Note Only external objects created using the Salesforce Connect: OData 2.0, OData 4.0, and Cross-Org adapters support restriction rules. Find out more in Restriction Rule Considerations.

     
| Criteria | Click Path | Field | Operator | Type | Value |
| --- | --- | --- | --- | --- | --- |
| User Criteria | **User** | **Department** | \[$User\].Department | Equals | String | Accounting |
| Record Criteria | **PurchaseOrder\_\_X** | **IsClosed\_\_c** | \[PurchaseOrder\_\_X\].IsClosed\_\_c | Equals | String | false |

## Provide User Access With Multiple String or ID Values in Record Criteria

This restriction rule allows active users to see records whose Name\_\_c field matches the rule’s record criteria values. The record criteria contains strings separated by a comma. ID values are also supported. Double-quotes specify that the value inside the quotes isn’t considered a delimiter.

This rule uses a custom object called Agent\_\_c with a custom text field called Name\_\_c.

     
| Criteria | Click Path | Field | Operator | Type | Value |
| --- | --- | --- | --- | --- | --- |
| User Criteria | **User** | **Active** | \[$User\].IsActive | Equals | Boolean | True |
| Record Criteria | **Agent\_\_c** | **Name\_\_c** | \[Agent\_\_c\].Name\_\_c | Equals | String | Tom, Anita, “Torres, Jia” |

This restriction rule allows active users to see records owned by two different managers. In this example, the rule’s record criteria contains ID’s separated by a comma.

     
| Criteria | Click Path | Field | Operator | Type | Value |
| --- | --- | --- | --- | --- | --- |
| User Criteria | **User** | **Active** | \[$User\].IsActive | Equals | Boolean | True |
| Record Criteria | **Agent\_\_c** | **Owner ID (User) Manager ID** | \[Agent\_\_c\].Owner:User:ManagerId | Equals | ID | 001xx000003HNy7, 001xx000003HNut |

#### See Also

- [Restriction Rule Considerations](https://help.salesforce.com/s/articleView?id=platform.security_restriction_rule_considerations.htm&release=264.0.0&type=5 "Keep these considerations and limitations in mind while using restriction rules.")