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.

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.

Important

Parent Type 

This type extends Metadata and inherits its fields.

File Suffix and Directory Location 

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

Version 

Introduced in API version 45.0.

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 

accessLevel 

  • Type: string

  • Required: Yes

  • Description: Type of access granted by the share rule. Valid values are:

    • Read
    • Edit

accountToCriteriaField 

  • Type: string

  • Required: Yes

  • 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.

    To get the full list for your org, do a Describe on the ARSR entity.

description 

  • Type: string
  • Required: No
  • Description: A meaningful explanation of the sharing rule.

entityType 

  • Type: string

  • Required: Yes

  • Description: The type of data shared by this share rule. Valid values are:

    • Account
    • Campaign
    • Case
    • Contact
    • Custom Object
    • Lead
    • Opportunity
    • Order
    • Quote

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

masterLabel 

  • Type: string
  • Required: Yes
  • Description: The label assigned to the sharing rule to identify it.

staticFormulaCriteria 

  • Type: string
  • Required: No
  • Description: A way to further filter what data gets shared. This string must be a deterministic formula, and spanning isn’t allowed.

type 

  • Type: string
  • Required: Yes
  • Description: Match the type of an account relationship for data to be shared according to the accountToCriteriaField and the staticFormulaCriteria fields.

Declarative Metadata Sample Definition 

The following is an example of an AccountRelationshipShareRule component.

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

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

1<Package>
2<?xml version="1.0" encoding="UTF-8"?>
3<Package xmlns="http://soap.sforce.com/2006/04/metadata">
4    <types>
5        <members>ArsrDevName</members>
6        <name>AccountRelationshipShareRule</name>
7    </types>
8<version>45.0</version>
9</Package>

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