---
schema_version: "1"
id: b90ac0ac87b2965ab69a878482c3ed54aec7be2ec7c5237b3f13b2ea2f854720
title: AccountRelationshipShareRule
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_accountrelationshipsharerule.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_accountrelationshipsharerule.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 241c56f30b22dc5c2c3964fa71f53e9f68649726ba0d6a9f71b9435c8e44e79d
description: The rule that determines which object records are shared, how they’re shared, the account relationship type that shares the records, and the level of access granted to the records.
---
# AccountRelationshipShareRule

The rule that determines which object records are shared, how they’re shared, the account relationship type that shares the records, and the level of access granted to the records.

![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.

This type extends the [MetadataWithContent](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_metadatawithcontent.htm "MetadataWithContent is the base type for all metadata types that contain content, such as documents or email templates. It extends Metadata. You can’t edit this object.") metadata type and inherits its content and fullName fields.

## File Suffix and Directory Location

AccountRelationshipShareRule components have the suffix .accountRelationshipShareRule and are stored in the .accountRelationshipShareRules folder.

## Version

AccountRelationshipShareRule components are available in API version 45.0 and later.

## Special Access Rules

Access to the AccountRelationshipShareRule type requires orgs to enable the Account Relationships permission. The Manage Experiences permission is required for user access.

## Fields

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



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

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

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

            </tr>

          </thead>

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

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

              <td class="entry" headers="d72704e121" data-title="Description">Type of access granted by the share rule. Valid values are: <ul class="ul bulletList">
                  <li class="li">Read</li>

                  <li class="li">Edit</li>

                </ul>
              </td>

            </tr>

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

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

              <td class="entry" headers="d72704e121" data-title="Description">Criteria that must be met for the data to be shared. Valid values include any
                custom or standard lookup to Account or User on top-level objects. <p class="p">To get the
                  full list for your org, do a Describe on the ARSR entity.</p>
              </td>

            </tr>

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

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

              <td class="entry" headers="d72704e121" data-title="Description">A meaningful explanation of the sharing rule.</td>

            </tr>

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

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

              <td class="entry" headers="d72704e121" data-title="Description">The type of data shared by this share rule. Valid values are: <ul class="ul bulletList">
                  <li class="li">Account</li>

                  <li class="li">Campaign</li>

                  <li class="li">Case</li>

                  <li class="li">Contact</li>

                  <li class="li">Custom Object</li>

                  <li class="li">Lead</li>

                  <li class="li">Opportunity</li>

                  <li class="li">Order</li>

                  <li class="li">Quote</li>

                </ul>
                API names of top-level custom objects in the org can also be used, for example,
                CustomObject__c.</td>

            </tr>

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

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

              <td class="entry" headers="d72704e121" data-title="Description">The label assigned to the sharing rule to identify it.</td>

            </tr>

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

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

              <td class="entry" headers="d72704e121" data-title="Description">A way to further filter what data gets shared. This string must be a
                deterministic formula, and spanning isn’t allowed.</td>

            </tr>

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

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

              <td class="entry" headers="d72704e121" data-title="Description">Match the type of an account relationship for data to be shared according to
                the accountToCriteriaField and the staticFormulaCriteria fields.</td>

            </tr>

          </tbody>

        </table>

## Declarative Metadata Sample Definition

The following is an example of an AccountRelationshipShareRule component.

<?xml version="1.0" encoding="UTF-8"?>
<AccountRelationshipShareRule xmlns="http://soap.sforce.com/2006/04/metadata">
    <accessLevel\>Edit</accessLevel\>
    <accountToCriteriaField\>Account.OwnerId</accountToCriteriaField\>
    <description\>TestDescription</description\>
    <entityType\>Account</entityType\>
    <masterLabel\>TestName</masterLabel\>
    <staticFormulaCriteria\>YearStarted = &quot;1980&quot;</staticFormulaCriteria\>
    <type\>Dealer</type\>
</AccountRelationshipShareRule\>

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

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

This metadata type supports the wildcard character \* (asterisk) in the package.xml manifest file.