---
schema_version: "1"
id: 7ba673b7c06ea981c0b844ca5dfb5512cdc5104a2dd9213e889519a75545695f
title: CriteriaBasedSharingRule
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_cbsrule.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_cbsrule.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1a805b6e30acf0cef3c05341ed35a4730576abadbda8d47ddb2f821512695fc5
description: This component is removed as of API version 33.0 and is available in earlier versions only. Use SharingRules instead. Represents a criteria-based sharing rule. CriteriaBasedSharingRule enables you to share records based on specific criteria.
---
# CriteriaBasedSharingRule

This component is removed as of API version 33.0 and is available in earlier versions only. Use [SharingRules](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm "Represents the base container for sharing rules, which can be criteria-based, ownership-based, territory-based, or for guest user access. SharingRules enables you to share records with a set of users, using rules that specify the access level for the target user group.") instead. Represents a criteria-based sharing rule. CriteriaBasedSharingRule enables you to share records based on specific criteria.

It extends the [BaseSharingRule](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_basesharingrule.htm "This component is removed as of API version 33.0 and is available in earlier versions only. Use SharingBaseRule instead. Represents the base container for criteria-based and owner-based sharing rules.") metadata type and inherits its sharedTo field. For more information, see “Criteria-Based Sharing Rules Overview” in Salesforce Help.

![Note](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png)

#### Note

You can’t create a CrteriaBasedSharingRule component directly. Use the child components instead.

## Declarative Metadata File Suffix and Directory Location

CriteriaBasedSharingRule components are stored within the SharingRules component in the criteriaBasedRules field.

## Version

CriteriaBasedSharingRule components are available in API version 24.0 and later.

## Special Access Rules

As of Spring ’20 and later, only users with the View Setup and Configuration permission can access this object, and only users with the Manage Sharing permission can edit this object.

## Fields

The following information assumes that you’re familiar with implementing sharing rules for standard objects and custom objects. For more information on these fields, see Sharing Settings in Salesforce Help.

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



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

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

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

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d234897e125" data-title="Field"><span class="keyword parmname" id="CriteriaItems-BA2C0F3A"><a name="CriteriaItems-BA2C0F3A"><!-- --></a>criteriaItems</span></td>

              <td class="entry" headers="d234897e128" data-title="Field Type">
                <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/customfield.htm#filteritem">FilterItem</a>[]
              </td>

              <td class="entry" headers="d234897e131" data-title="Description">List that represents the criteria for the sharing rule. The possible values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">field</samp></li>

                  <li class="li"><samp class="codeph nolang">operation</samp></li>

                  <li class="li"><samp class="codeph nolang">value</samp></li>

                </ul>
              </td>

            </tr>

          </tbody>

        </table>

## AccountCriteriaBasedSharingRule

Represents a criteria-based sharing rule for accounts. It extends the CriteriaBasedSharingRule metadata type and inherits its criteriaItems field.

AccountCriteriaBasedSharingRule is used by the criteriaBasedRules field in [AccountSharingRules](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm#AccountSharingRules).

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



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

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

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

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d234897e207" data-title="Field"><span class="keyword parmname">accountAccessLevel</span></td>

              <td class="entry" headers="d234897e210" data-title="Field Type">
                <samp class="codeph nolang">ShareAccessLevelNoNone</samp> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d234897e213" data-title="Description">Required. A value that represents the level of access that the user or group
                has to the account. The possible values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                  <li class="li"><samp class="codeph nolang">All</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e207" data-title="Field"><span class="keyword parmname">booleanFilter</span></td>

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

              <td class="entry" headers="d234897e213" data-title="Description">Represents the filter logic of the sharing rule.</td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e207" data-title="Field"><span class="keyword parmname">caseAccessLevel</span></td>

              <td class="entry" headers="d234897e210" data-title="Field Type">
                <samp class="codeph nolang">ShareAccessLevelNoAll</samp> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d234897e213" data-title="Description">Required. A value that represents the level of access that the user or group
                has to cases associated with the account. The possible values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">None</samp></li>

                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e207" data-title="Field"><span class="keyword parmname">contactAccessLevel</span></td>

              <td class="entry" headers="d234897e210" data-title="Field Type">
                <samp class="codeph nolang">ShareAccessLevelNoAll</samp> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d234897e213" data-title="Description">Required. A value that represents the level of access that the user or group
                has to contacts associated with the account. The possible values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">None</samp></li>

                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                </ul>
              </td>

            </tr>

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

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

              <td class="entry" headers="d234897e213" data-title="Description">Represents the description of the sharing rule. Maximum of 1000 characters. <p class="p" id="descAPI"><a name="descAPI"><!-- --></a>This field is available in API version 29.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e207" data-title="Field"><span class="keyword parmname">name</span></td>

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

              <td class="entry" headers="d234897e213" data-title="Description">Required. Name for the sharing rule. Corresponds to
                <strong class="ph uicontrol">Label</strong> in the user interface.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e207" data-title="Field"><span class="keyword parmname">opportunityAccessLevel</span></td>

              <td class="entry" headers="d234897e210" data-title="Field Type">
                <samp class="codeph nolang">ShareAccessLevelNoAll</samp> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d234897e213" data-title="Description">Required. A value that represents the level of access that a target group is
                granted for any associated opportunity. The possible values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">None</samp></li>

                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                </ul>
              </td>

            </tr>

          </tbody>

        </table>

## CampaignCriteriaBasedSharingRule

Represents a criteria-based sharing rule for campaigns. It extends the CriteriaBasedSharingRule metadata type and inherits its criteriaItems field.

CampaignCriteriaBasedSharingRule is used by the criteriaBasedRules field in [CampaignSharingRules](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm#CampaignSharingRules).

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



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

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

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

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d234897e420" data-title="Field"><span class="keyword parmname">booleanFilter</span></td>

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

              <td class="entry" headers="d234897e426" data-title="Description">Represents the filter logic of the sharing rule.</td>

            </tr>

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

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

              <td class="entry" headers="d234897e426" data-title="Description">Represents the description of the sharing rule. Maximum of 1000 characters.
                This field is available in API version 29.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e420" data-title="Field"><span class="keyword parmname">campaignAccessLevel</span></td>

              <td class="entry" headers="d234897e423" data-title="Field Type">
                <samp class="codeph nolang">ShareAccessLevelNoNone</samp> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d234897e426" data-title="Description">Required. A value that represents the level of access that a target group is
                granted for a campaign. The possible values are: <ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                  <li class="li"><samp class="codeph nolang">All</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e420" data-title="Field"><span class="keyword parmname">name</span></td>

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

              <td class="entry" headers="d234897e426" data-title="Description">Required. Name for the sharing rule. Corresponds to
                <strong class="ph uicontrol">Label</strong> in the user interface.
              </td>

            </tr>

          </tbody>

        </table>

## CaseCriteriaBasedSharingRule

Represents a criteria-based sharing rule for cases. It extends the CriteriaBasedSharingRule metadata type and inherits its criteriaItems field.

CaseCriteriaBasedSharingRule is used by the criteriaBasedRules field in [CaseSharingRules](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm#CaseSharingRules).

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



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

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

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

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d234897e543" data-title="Field"><span class="keyword parmname">booleanFilter</span></td>

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

              <td class="entry" headers="d234897e549" data-title="Description">Represents the filter logic of the sharing rule.</td>

            </tr>

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

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

              <td class="entry" headers="d234897e549" data-title="Description">Represents the description of the sharing rule. Maximum of 1000
                characters.<p class="p">This field is available in API version 29.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e543" data-title="Field"><span class="keyword parmname">caseAccessLevel</span></td>

              <td class="entry" headers="d234897e546" data-title="Field Type">
                <samp class="codeph nolang">ShareAccessLevelReadEdit</samp> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d234897e549" data-title="Description">Required. A value that represents the level of access being granted for a case.
                The possible values are: <ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e543" data-title="Field"><span class="keyword parmname">name</span></td>

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

              <td class="entry" headers="d234897e549" data-title="Description">Required. Name for the sharing rule. Corresponds to
                <strong class="ph uicontrol">Label</strong> in the user interface.
              </td>

            </tr>

          </tbody>

        </table>

## ContactCriteriaBasedSharingRule

Represents a criteria-based sharing rule for contacts. It extends the CriteriaBasedSharingRule metadata type and inherits its criteriaItems field.

ContactCriteriaBasedSharingRule is used by the criteriaBasedRules field in [ContactSharingRules](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm#ContactSharingRules).

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



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

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

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

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d234897e664" data-title="Field"><span class="keyword parmname">booleanFilter</span></td>

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

              <td class="entry" headers="d234897e670" data-title="Description">Represents the filter logic of the sharing rule.</td>

            </tr>

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

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

              <td class="entry" headers="d234897e670" data-title="Description">Represents the description of the sharing rule. Maximum of 1000
                characters.<p class="p">This field is available in API version 29.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e664" data-title="Field"><span class="keyword parmname">contactAccessLevel</span></td>

              <td class="entry" headers="d234897e667" data-title="Field Type">
                <samp class="codeph nolang">ShareAccessLevelReadEdit</samp> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d234897e670" data-title="Description">Required. A value that represents the level of access being granted to the
                target group, role, or user for a contact. The possible values are: <ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e664" data-title="Field"><span class="keyword parmname">name</span></td>

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

              <td class="entry" headers="d234897e670" data-title="Description">Required. Name for the sharing rule. Corresponds to
                <strong class="ph uicontrol">Label</strong> in the user interface.
              </td>

            </tr>

          </tbody>

        </table>

## LeadCriteriaBasedSharingRule

Represents a criteria-based sharing rule for leads. It extends the CriteriaBasedSharingRule metadata type and inherits its criteriaItems field.

LeadCriteriaBasedSharingRule is used by the criteriaBasedRules field in [LeadSharingRules](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm#LeadSharingRules).

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



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

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

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

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d234897e785" data-title="Field"><span class="keyword parmname">booleanFilter</span></td>

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

              <td class="entry" headers="d234897e791" data-title="Description">Represents the filter logic of the sharing rule.</td>

            </tr>

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

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

              <td class="entry" headers="d234897e791" data-title="Description">Represents the description of the sharing rule. Maximum of 1000 characters.
                This field is available in API version 29.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e785" data-title="Field"><span class="keyword parmname">leadAccessLevel</span></td>

              <td class="entry" headers="d234897e788" data-title="Field Type">
                <samp class="codeph nolang">ShareAccessLevelReadEdit</samp> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d234897e791" data-title="Description">Required. A value that represents the level of allowed access. The possible
                values are: <ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e785" data-title="Field"><span class="keyword parmname">name</span></td>

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

              <td class="entry" headers="d234897e791" data-title="Description">Required. Name for the sharing rule. Corresponds to
                <strong class="ph uicontrol">Label</strong> in the user interface.
              </td>

            </tr>

          </tbody>

        </table>

## OpportunityCriteriaBasedSharingRule

Represents a criteria-based sharing rule for opportunities. It extends the CriteriaBasedSharingRule metadata type and inherits its criteriaItems field.

OpportunityCriteriaBasedSharingRule is used by the criteriaBasedRules field in [OpportunitySharingRules](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm#OpportunitySharingRules).

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



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

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

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

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d234897e905" data-title="Field"><span class="keyword parmname">booleanFilter</span></td>

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

              <td class="entry" headers="d234897e911" data-title="Description">Represents the filter logic of the sharing rule.</td>

            </tr>

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

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

              <td class="entry" headers="d234897e911" data-title="Description">Represents the description of the sharing rule. Maximum of 1000
                characters.<p class="p">This field is available in API version 29.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e905" data-title="Field"><span class="keyword parmname">opportunityAccessLevel</span></td>

              <td class="entry" headers="d234897e908" data-title="Field Type">
                <samp class="codeph nolang">ShareAccessLevelReadEdit</samp> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d234897e911" data-title="Description">Required. A value that represents the level of allowed access. The possible
                values are: <ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e905" data-title="Field"><span class="keyword parmname">name</span></td>

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

              <td class="entry" headers="d234897e911" data-title="Description">Required. Name for the sharing rule. Corresponds to
                <strong class="ph uicontrol">Label</strong> in the user interface.
              </td>

            </tr>

          </tbody>

        </table>

## CustomObjectCriteriaBasedSharingRule

Represents a criteria-based sharing rule for custom objects. It extends the CriteriaBasedSharingRule metadata type and inherits its criteriaItems field.

CustomObjectCriteriaBasedSharingRule is used by the criteriaBasedRules field in [CustomObjectSharingRules](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm#CustomObjectSharingRules).

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



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

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

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

            </tr>

          </thead>

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

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

              <td class="entry" headers="d234897e1032" data-title="Description">Required. A value that represents the type of allowed sharing. The possible
                values are: <ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                  <li class="li"><samp class="codeph nolang">All</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e1026" data-title="Field"><span class="keyword parmname">booleanFilter</span></td>

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

              <td class="entry" headers="d234897e1032" data-title="Description"><span class="ph" id="bool"><a name="bool"><!-- --></a>Represents the filter logic of the sharing rule.</span></td>

            </tr>

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

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

              <td class="entry" headers="d234897e1032" data-title="Description">Represents the description of the sharing rule. Maximum of 1000 characters.
                <p class="p">This field is available in API version 29.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e1026" data-title="Field"><span class="keyword parmname">name</span></td>

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

              <td class="entry" headers="d234897e1032" data-title="Description">Required. Name for the sharing rule. Corresponds to
                <strong class="ph uicontrol">Label</strong> in the user interface.
              </td>

            </tr>

          </tbody>

        </table>

## UserCriteriaBasedSharingRule

Represents a criteria-based sharing rule for users. It extends the CriteriaBasedSharingRule metadata type and inherits its criteriaItems field.

UserCriteriaBasedSharingRule is used by the criteriaBasedRules field in [UserSharingRules](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm#UserSharingRules).

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



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

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

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

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d234897e1150" data-title="Field"><span class="keyword parmname">booleanFilter</span></td>

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

              <td class="entry" headers="d234897e1156" data-title="Description">Represents the filter logic of the sharing rule.</td>

            </tr>

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

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

              <td class="entry" headers="d234897e1156" data-title="Description">Represents the description of the sharing rule. Maximum of 1000 characters.
                <p class="p">This field is available in API version 29.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e1150" data-title="Field"><span class="keyword parmname">name</span></td>

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

              <td class="entry" headers="d234897e1156" data-title="Description">Required. Name for the sharing rule. Corresponds to
                <strong class="ph uicontrol">Label</strong> in the user interface.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d234897e1150" data-title="Field"><span class="keyword parmname">userAccessLevel</span></td>

              <td class="entry" headers="d234897e1153" data-title="Field Type">
                <samp class="codeph nolang">ShareAccessLevelReadEdit</samp> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d234897e1156" data-title="Description">Required. A value that represents the type of allowed sharing. The possible
                values are: <ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Read</samp></li>

                  <li class="li"><samp class="codeph nolang">Edit</samp></li>

                </ul>
              </td>

            </tr>

          </tbody>

        </table>

## Declarative Metadata Sample Definition

The following is the definition of two owner-based sharing rules and one criteria-based sharing rule containing two criteria items. The file name corresponds to the Account.sharingRules file under the accountSharingRules directory.

<?xml version="1.0" encoding="UTF-8"?>
<AccountSharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
  <ownerRules\>
    <fullName\>G1Dev\_G2New</fullName\>
    <sharedTo\>
      <group\>G2New</group\>
    </sharedTo\>
    <sharedFrom\>
      <group\>G1Dev</group\>
    </sharedFrom\>
    <accountAccessLevel\>Read</accountAccessLevel\>
    <caseAccessLevel\>None</caseAccessLevel\>
    <contactAccessLevel\>Read</contactAccessLevel\>
  </ownerRules\>
    <fullName\>G2New\_R1New</fullName\>
    <sharedTo\>
      <roleAndSubordinates\>R1New</roleAndSubordinates\>
    </sharedTo\>
    <sharedFrom\>
      <group\>G2New</group\>
    </sharedFrom\>
    <accountAccessLevel\>Edit</accountAccessLevel\>
    <caseAccessLevel\>Read</caseAccessLevel\>
    <contactAccessLevel\>Edit</contactAccessLevel\>
    <name\>G2New\_R1New</name\>
    <opportunityAccessLevel\>None</opportunityAccessLevel\>
  </ownerRules\>
  <criteriaBasedRules\>
    <fullName\>AccountCriteria</fullName\>
    <sharedTo\>
      <group\>G1</group\>
    </sharedTo\>
    <criteriaItems\>
      <field\>BillingCity</field\>
      <operation\>equals</operation\>
      <value\>San Francisco</value\>
    </criteriaItems\>
    <criteriaItems\>
      <field\>MyChkBox\_\_c</field\>
      <operation\>notEqual</operation\>
      <value\>False</value\>
    </criteriaItems\>
    <accountAccessLevel\>Read</accountAccessLevel\>
    <booleanFilter\>1 OR 2</booleanFilter\>
    <caseAccessLevel\>None</caseAccessLevel\>
    <contactAccessLevel\>Read</contactAccessLevel\>
    <name\>AccountCriteria</name\>
    <opportunityAccessLevel\>None</opportunityAccessLevel\>
  </criteriaBasedRules\>
</AccountSharingRules\>

## Wildcard Support in the Manifest File

This metadata type supports the wildcard character \* (asterisk) in the package.xml manifest file. For information about using the manifest file, see [Deploying and Retrieving Metadata with the Zip File](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/file_based_zip_file.htm "The deploy() and retrieve() calls are used to deploy and retrieve a .zip file. Within the .zip file is a project manifest (package.xml) that lists what to retrieve or deploy, and one or more XML components that are organized into folders.").

- [← Previous](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_basesharingrule.htm "BaseSharingRule")
- [Next →](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_ownersharingrule.htm "OwnerSharingRule")