---
schema_version: "1"
id: 5b45d8bf9485377ed259be0930305a9e62ca37ca7f5a9ea02bbaf22125d9b279
title: FieldRestrictionRule
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_fieldrestrictionrule.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_fieldrestrictionrule.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 380607264e00ed7d82e3331de8869f373edd3ed296a9ad1a29e57a5dfbb661c2
description: Represents a field visibility rule that controls whether a field is visible to a user, based on the field’s inclusion in a field set. If Enhanced Personal Information Management setting was enabled before Spring ’22, field visibility is based on the field’s compliance categorization. This type extends the Metadata metadata type and inherits its fullName field.
---
# FieldRestrictionRule

Represents a field visibility rule that controls whether a field is visible to a user, based on the field’s inclusion in a field set. If Enhanced Personal Information Management setting was enabled before Spring ’22, field visibility is based on the field’s compliance categorization. This type extends the Metadata metadata type and inherits its fullName field.

![Important](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note_important.png)

#### Important

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

## File Suffix and Directory Location

FieldRestrictionRule components have the suffix .rule and are stored in the fieldRestrictionRules folder.

## Version

FieldRestrictionRule components are available in API version 52.0 and later.

## Special Access Rules

- To access this type, you must have the Manage Sharing permission.
- To create and manage Employee field visibility rules, you must be assigned a Workplace Command Center permission set license and the Provides access to Workplace Command Center features system permission.
- To create and manage User field visibility rules, you must enable Digital Experiences and the Enhanced Personal Information Management feature.

## Fields

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d502160e112">Field Name</th>

              <th class="featureTableHeader  " id="d502160e115">Field Type</th>

              <th class="featureTableHeader  " id="d502160e118">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d502160e112" data-title="Field Name"><span class="keyword parmname">active</span></td>

              <td class="entry" headers="d502160e115" data-title="Field Type">boolean</td>

              <td class="entry" headers="d502160e118" data-title="Description">Indicates whether the rule is active (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>). The default
                value is <samp class="codeph nolang">false</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d502160e112" data-title="Field Name"><span class="keyword parmname">classification</span></td>

              <td class="entry" headers="d502160e115" data-title="Field Type">string[]</td>

              <td class="entry" headers="d502160e118" data-title="Description">Required. The data classification compliance categorization or field set that
                is targeted by the rule. The rule applies to fields that are marked with this
                categorization or included in this field set. If you enabled Enhanced Personal
                Information Management before Spring ‘22 (API version 54.0), you can use
                Salesforce's default compliance categorization values or values that you add
                yourself. If you enabled Enhanced Personal Information Management after Spring ‘22
                (API version 54.0), use the PersonalInfo_EPIM field set or a field set that you add
                yourself.</td>

            </tr>

            <tr>
              <td class="entry" headers="d502160e112" data-title="Field Name"><span class="keyword parmname">classificationType</span></td>

              <td class="entry" headers="d502160e115" data-title="Field Type">ClassificationType (<a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title">enumeration</a> of type
                string)</td>

              <td class="entry" headers="d502160e118" data-title="Description">The type of classification method used in your org. If you enabled Enhanced
                Personal Information Management before Spring ‘22 (API version 54.0), use <samp class="codeph nolang">ComplianceCategory</samp>. If you enabled Enhanced Personal
                Information Management after Spring ‘22, use <samp class="codeph nolang">FieldSet</samp>.<ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph nolang">ComplianceCategory</samp>—
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">FieldSet</samp>—
                  </li>

                </ul>
                The default value is <samp class="codeph nolang">ComplianceCategory</samp>.
                Available in API version 54.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d502160e112" data-title="Field Name"><span class="keyword parmname">description</span></td>

              <td class="entry" headers="d502160e115" data-title="Field Type">string</td>

              <td class="entry" headers="d502160e118" data-title="Description">Required. The description of the rule.</td>

            </tr>

            <tr>
              <td class="entry" headers="d502160e112" data-title="Field Name"><span class="keyword parmname">enforcementType</span></td>

              <td class="entry" headers="d502160e115" data-title="Field Type">EnforcementType (enumeration of type string)</td>

              <td class="entry" headers="d502160e118" data-title="Description">Required. The type of rule. Possible values are:<ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph nolang">FieldRestrict</samp>—Field visibility
                    rule. Only this value is valid.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">Restrict</samp>—Do not use.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">Scoping</samp>—Do not use.
                  </li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d502160e112" data-title="Field Name"><span class="keyword parmname">masterLabel</span></td>

              <td class="entry" headers="d502160e115" data-title="Field Type">string</td>

              <td class="entry" headers="d502160e118" data-title="Description">Required. The name of the rule.</td>

            </tr>

            <tr>
              <td class="entry" headers="d502160e112" data-title="Field Name"><span class="keyword parmname">recordFilter</span></td>

              <td class="entry" headers="d502160e115" data-title="Field Type">string</td>

              <td class="entry" headers="d502160e118" data-title="Description">Required. The criteria that determine which fields are visible to the specified
                users. For example, the field can check if the logged-in user matches the Employee’s
                ID.</td>

            </tr>

            <tr>
              <td class="entry" headers="d502160e112" data-title="Field Name"><span class="keyword parmname">targetEntity</span></td>

              <td class="entry" headers="d502160e115" data-title="Field Type">string</td>

              <td class="entry" headers="d502160e118" data-title="Description">Required. The object for which you're creating the rule. Only the Employee and
                User objects are supported.</td>

            </tr>

            <tr>
              <td class="entry" headers="d502160e112" data-title="Field Name"><span class="keyword parmname">userCriteria</span></td>

              <td class="entry" headers="d502160e115" data-title="Field Type">string</td>

              <td class="entry" headers="d502160e118" data-title="Description">Required. The users that this rule applies to, such as all active users or
                users with a specified role or profile.</td>

            </tr>

            <tr>
              <td class="entry" headers="d502160e112" data-title="Field Name"><span class="keyword parmname">version</span></td>

              <td class="entry" headers="d502160e115" data-title="Field Type">int</td>

              <td class="entry" headers="d502160e118" data-title="Description">Required. The rule's version number.</td>

            </tr>

          </tbody>

        </table>

## Declarative Metadata Sample Definition

The following is an example of a FieldRestrictionRule component, which uses the ComplianceCategory classification type. The classification value is one of Salesforce's default compliance categorization values, but you can create a custom compliance categorization value to use instead.

<?xml version="1.0" encoding="UTF-8"?>
<FieldRestrictionRule xmlns="http://soap.sforce.com/2006/04/metadata">
    <active\>true</active\>
    <classification\>PII</classification\>
    <classificationType\>ComplianceCategory</classificationType\>
    <description\>Is Owner of Employee</description\>
    <enforcementType\>FieldRestrict</enforcementType\>
    <masterLabel\>Is Owner Field Restriction Rule</masterLabel\>
    <recordFilter\>OwnerId = $User.Id</recordFilter\>
    <targetEntity\>Employee</targetEntity\>
    <userCriteria\>$User.IsActive = true</userCriteria\>
    <version\>1</version\>
</FieldRestrictionRule\>

The following is an example of a FieldRestrictionRule component, which uses the FieldSet classification type. The classification value is Salesforce's default field set for personal information, but you can create a field set to use instead.

<?xml version="1.0" encoding="UTF-8"?>
<FieldRestrictionRule xmlns="http://soap.sforce.com/2006/04/metadata">
    <active\>true</active\>
    <classification\>PersonalInfo\_EPIM</classification\>
    <classificationType\>FieldSet</classificationType\>
    <description\>Is Owner of Employee</description\>
    <enforcementType\>FieldRestrict</enforcementType\>
    <masterLabel\>Is Owner Field Restriction Rule</masterLabel\>
    <recordFilter\>OwnerId = $User.Id</recordFilter\>
    <targetEntity\>Employee</targetEntity\>
    <userCriteria\>$User.IsActive = true</userCriteria\>
    <version\>1</version\>
</FieldRestrictionRule\>

The following is an example package.xml that references the previous definition.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <members\>\*</members\>
        <name\>FieldRestrictionRule</name\>
    </types\>
    <version\>52.0</version\>
</Package\>