Newer Version Available

This content describes an older version of this product. View Latest

AccountRelationshipShareRule

Represents the rule that determines which object records are shared, how they are shared, the account relationship type that shares the records, and the level of access granted to the records. This type extends the MetadataWithContent 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 and later.

Special Access Rules

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

Fields

Field Name Field Type Description
accessLevel string Type of access granted by the share rule. Valid values are:
  • Read
  • Edit
accountToCriteriaField string Criteria that must be met for the data to be shared. Valid values are:
  • Account.OwnerId
  • Account.ParentId
  • Campaign.OwnerId
  • Case.AccountId
  • Case.OwnerId
  • Contact.AccountId
  • Contact.OwnerId
  • Lead.ConvertedAccountId
  • Lead.OwnerId
  • Lead.PartnerAccountId
  • Opportunity.AccountId
  • Opportunity.OwnerId
  • Opportunity.PartnerAccountId
  • Order.AccountId
  • Order.OwnerId

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

description string A meaningful explanation of the sharing rule.
entityType string The type of data being shared by this share rule. Valid values are:
  • Account
  • Campaign
  • Case
  • Contact
  • Lead
  • Opportunity
  • Order
API names of top level custom objects in the org may also be used, e.g. CustomObject__c.
masterLabel string The label assigned to the sharing rule to identify it.
staticFormulaCriteria string A way to further filter what data gets shared. This must be a deterministic formula and spanning is not allowed.
type string Must 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.