AccountRelationshipShareRule defines record sharing driven by account relationships. It selects the object records eligible for sharing, the account relationship type that enables sharing, the criteria those records must meet, and the access granted.
This type is sharing configuration, not an account relationship record. To determine its actual effect, you must also consider the matching account relationships and record data in the org. The type element identifies an account relationship type; entityType identifies the object whose records can be shared.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The metadata component identity. This is distinct from the user-facing label in masterLabel. |
entityType |
The object whose records can be shared. Documented values are Account, Campaign, Case, Contact, Custom Object, Lead, Opportunity, Order, and Quote. API names of top-level custom objects, such as CustomObject__c, are also supported. |
type |
The account relationship type that must match for sharing to occur according to accountToCriteriaField and staticFormulaCriteria. |
accountToCriteriaField |
The lookup-based sharing criterion. Supported choices include standard or custom lookups to Account or User on top-level objects. Valid choices depend on the org. |
staticFormulaCriteria |
A formula that further filters eligible records. It must be deterministic, meaning it produces the same result for the same inputs. Relationship spanning is not allowed. |
accessLevel |
The access granted by the rule. Allowed values are Read and Edit. |
masterLabel |
The user-facing label used to identify the sharing rule. |
description |
An explanation of the sharing rule. |
Behavior and Constraints
The org must have the Account Relationships permission enabled. The user accessing this metadata type must have the Manage Experiences permission.
The sharing settings work together. entityType selects the object, while type must match the type of an account relationship. The lookup criterion in accountToCriteriaField and the filter in staticFormulaCriteria determine eligible records, and accessLevel specifies the access granted. Neither entityType nor type alone describes the complete sharing scope.
To obtain the full list of valid accountToCriteriaField choices for an org, perform a Describe operation on the ARSR entity. Describe returns information about the entity's available fields and values. Account.OwnerId is a documented example, not a default.
The restriction against relationship spanning applies to staticFormulaCriteria: the formula cannot traverse relationships to filter records. Do not confuse that restriction with qualified field notation such as Account.OwnerId in accountToCriteriaField.
Deployment and Retrieval
Components use the .accountRelationshipShareRule file suffix and are stored in the .accountRelationshipShareRules folder.
In a package.xml manifest, use AccountRelationshipShareRule as the metadata type name and the component's fullName as the member. The type supports the wildcard * in the manifest. Use the component identity rather than its masterLabel when selecting a member.
When moving a rule between orgs, account for its object and field dependencies and the target org's valid criteria fields. A top-level custom object can be identified by its API name, and a custom lookup used by accountToCriteriaField is a field dependency. The Account Relationships and Manage Experiences prerequisites also apply to metadata access.
Retrieving the rule captures its sharing configuration. The rule definition does not establish which live account relationships match it or which records currently qualify for sharing.
Relationships
The object and field connections identify configuration dependencies. They do not establish the live relationships or record data needed for the rule to grant access.
References
-
CustomObject:entityType. -
CustomField:accountToCriteriaField.
Common Questions
What permissions are required to access AccountRelationshipShareRule?
The org must have the Account Relationships permission enabled, and the user must have Manage Experiences.
What is the difference between type and entityType?
type identifies the account relationship type that must match. entityType identifies the object whose records can be shared, such as Account, Case, or a top-level custom object.
Which fields can I use in accountToCriteriaField?
Supported choices include standard or custom lookups to Account or User on top-level objects. Perform a Describe on the ARSR entity for the full list in your org. Account.OwnerId is an example, not a required value.
Can staticFormulaCriteria use fields across relationships?
No. The formula must be deterministic and cannot span relationships. This restriction does not prohibit qualified field notation in the separate accountToCriteriaField element.
Why doesn't the rule definition prove that records are being shared?
The metadata defines the sharing conditions, but its effect also depends on matching account relationships and eligible record data in the org. The relationship type, lookup criterion, and formula filter must be considered together.