FieldRestrictionRule defines field visibility rules for Employee or User records. It selects the fields governed by a rule, identifies the users subject to it, and supplies the criteria that govern visibility. It is a field visibility rule, not a record restriction rule or a scoping rule.
A rule's presence does not mean it is enforcing visibility. To understand its effect, read its activation state, field classification, user criteria, and visibility criteria together.
Key Elements
| Element | What the Element Controls |
|---|---|
active |
Whether the rule is active. Defaults to false. |
classification |
Required. Selects field sets or compliance categorization values, according to classificationType. The Metadata API defines this element as string[]. |
classificationType |
Selects ComplianceCategory or FieldSet. Defaults to ComplianceCategory; specify FieldSet explicitly for a field-set-based rule. |
enforcementType |
Required. Must be FieldRestrict. Shared enumeration values Restrict, Scoping, and D360_Restrict are not valid for this type. |
recordFilter |
Required. Supplies the visibility criteria for the users selected by userCriteria. |
targetEntity |
Required. Identifies the object governed by the rule. Only Employee and User are supported. |
userCriteria |
Required. Selects the users subject to the rule, such as active users or users with a specified role or profile. |
version |
Required integer containing the rule's version number. This is not the Metadata API transport version. |
Behavior and Constraints
Interpret the field selection and criteria together
classificationType determines how to interpret classification. Neither element identifies which users are governed by the rule; that is the role of userCriteria. The recordFilter then supplies the visibility condition for those users.
For example, userCriteria can contain $User.IsActive = true while recordFilter contains OwnerId = $User.Id. Together, these express an ownership-based visibility condition for active users. This is an example, not a required or default policy.
Match the classification method used by the org
-
Field-set selection: With
classificationTypeset toFieldSet,classificationidentifiesPersonalInfo_EPIMor a custom field set. A field set is a named collection of fields. Changing its membership can change the rule's field scope without changing the rule itself. -
Compliance-category selection: With
classificationTypeset toComplianceCategory,classificationidentifies compliance categorization values, including custom values. The rule's scope depends on fields marked with those categories. A categorization records a classification; it does not independently grant permissions or establish regulatory compliance.
The classification method must match the method used by the org. Because the documented default is ComplianceCategory, omitting classificationType does not express a field-set-based definition.
Access and administration prerequisites
Access to this metadata type requires the Manage Sharing permission. Additional requirements depend on the target object:
- Employee: Creating and managing rules requires a Workplace Command Center permission set license and the Provides access to Workplace Command Center features system permission.
- User: Creating and managing rules requires Digital Experiences and Enhanced Personal Information Management to be enabled.
These prerequisites govern access to and management of the configuration. They are separate from userCriteria, which selects the users governed by the rule.
Deployment and Retrieval
Metadata API components use the .rule suffix and reside in the fieldRestrictionRules folder. A package.xml manifest identifies the type as FieldRestrictionRule; the documented manifest example uses * as its member selector.
The type inherits fullName from Metadata. Its masterLabel and description are required, in addition to the required elements shown above.
-
Activation: Do not infer enforcement from successful deployment or retrieval. Read
active; its default isfalse. - Field dependencies: A field-set-based rule depends on the referenced field set and its membership. A compliance-category-based rule depends on the corresponding field categorizations. The rule definition alone does not describe the complete field scope.
- Destination configuration: The destination org's features and the administrator's permissions matter when planning deployment or diagnosing management-access problems. Apply the target-specific prerequisites above.
-
Classification serialization: The Metadata API defines
classificationasstring[], while tooling can expose it as a single string. Account for this cardinality difference when interpreting retrieved classifications or serializing a definition for deployment. -
Rule version: Keep the required
versionelement distinct from the API version used to send a deployment or retrieval request.
The metadata type or rule name alone cannot establish a user's effective visibility. That assessment requires the activation state, classification method and selected fields, userCriteria, and recordFilter.
Relationships
The field selection can reference field-set metadata, and the target object is represented by object metadata. The object relationship does not broaden the allowed targets beyond Employee and User.
References
-
FieldSet:classification, whenclassificationTypeisFieldSet. -
CustomObject:targetEntity, limited toEmployeeandUser.
Reported Issues
-
Direct Apex querying was reported as unavailable. A 2021 community answer listed
FieldRestrictionRuleamong types that were not available in the ApexSchemanamespace and could not be queried directly in Apex. This is a report about Apex query access, not a statement that Metadata API retrieval is unavailable. See the Apex query availability discussion. -
A public-site Flow reportedly stopped finding existing User records after a full-copy sandbox refresh. In a 2022 report, the Screen Flow ran in System Context Without Sharing and worked in production and Flow Debug, including when debugging as the guest user, but failed through the sandbox's public Site page. A query returned two
FieldRestrictionRulerecords in the sandbox and none in production. The author also reported Enhanced Personal Information Management disabled in both orgs, and a Hide Personal Information option enabled in production but unavailable in the sandbox. No answer established the cause, so the differing rule counts do not prove that the rules caused the Flow behavior. See the public-site Flow visibility report.
Common Questions
Does deploying a FieldRestrictionRule automatically activate it?
No. Activation is controlled by active, which defaults to false. The component's presence does not establish that it is enforcing field visibility.
Should classificationType be FieldSet or ComplianceCategory?
Use the classification method used by the org. FieldSet selects fields through PersonalInfo_EPIM or a custom field set. ComplianceCategory selects fields through their compliance categorization values. Specify FieldSet explicitly because the documented default is ComplianceCategory.
Can a FieldRestrictionRule target a custom object?
No. Although targetEntity references object metadata represented by CustomObject, its supported values are only Employee and User.
What permissions and features are required to manage FieldRestrictionRule?
Access requires Manage Sharing. Employee rules also require a Workplace Command Center permission set license and the Provides access to Workplace Command Center features system permission. User rules require Digital Experiences and Enhanced Personal Information Management to be enabled.
Can field visibility change without changing the rule file?
Yes. In FieldSet mode, changing the referenced field set's membership changes the selected field scope. In ComplianceCategory mode, the scope depends on which fields carry the selected categorizations.