---
schema_version: "1"
id: 2283d327fe6b7eceb76bcbc2998d00390bbb6aa2ae9201b83cb80ee45c5cfc3b
title: AssignmentRules
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_assignmentrule.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_assignmentrule.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: b4bc77c992221b2066158644738727020c3bf6c89f6f48d2bf8cfbc6b539c384
description: Represents assignment rules that allow you to automatically route cases to the appropriate users or queues. You can access rules metadata for all applicable objects, for a specific object, or for a specific rule on a specific object.
---
# AssignmentRules

Represents assignment rules that allow you to automatically route cases to the appropriate users or queues. You can access rules metadata for all applicable objects, for a specific object, or for a specific rule on a specific object.

The package.xml syntax for accessing all assignment rules for all objects is:

    <types>
        <members>\*</members>
        <name>AssignmentRules</name>
    </types>

All rules for a specific object use a similar syntax without the wildcard. For example, all assignment rules for the Case object would use this syntax:

    <types>
        <members>Case</members>
        <name>AssignmentRules</name>
    </types>

You can also access specific assignment rules for an object. The following example only accesses the “samplerule” and “newrule” assignment rules on the Case object. Notice that for this example the type name syntax is AssignmentRule and not AssignmentRules.

    <types>
        <members>Case.samplerule</members>
        <members>Case.newrule</members>
        <name>AssignmentRule</name>
    </types>

## File Suffix and Directory Location

Assignment rules for an object have the suffix .assignmentRules and are stored in the assignmentRules folder. For example, all Case assignment rules are stored in the Case.assignmentRules file.

## Version

AssignmentRules components are available in API version 27.0 and later.

## Fields

| Field Name | Field Type | Description |
| --- | --- | --- |
| assignmentRule | [AssignmentRule\[\]](#AssignmentRule_sub) | Represents the definitions of the named assignment rules. |

## AssignmentRule

Specifies whether the rule is active or not and its definition. Rules are processed in the order they appear within the AssignmentRules container.

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



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

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

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

            </tr>

          </thead>

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

              <td class="entry" headers="d155746e165" data-title="Field Type">boolean</td>

              <td class="entry" headers="d155746e168" data-title="Description">Indicates whether the assignment rule is active (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>).</td>

            </tr>

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

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

              <td class="entry" headers="d155746e168" data-title="Description">Inherited from <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm" title="The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.">Metadata</a>, this field is defined in the WSDL for this
                metadata type. It must be specified when creating, updating, or
                deleting. See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_createMetadata.htm" title="Adds one or more new metadata components to your organization synchronously."><samp class="codeph java">createMetadata()</samp></a>
                to see an example of this field specified for a call.<p class="p">This value
                  can't be <samp class="codeph java">null</samp>.</p>
              </td>

            </tr>

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

              <td class="entry" headers="d155746e165" data-title="Field Type"><span class="keyword parmname"><a class="xref" href="#RuleEntry_title">RuleEntry[]</a></span></td>

              <td class="entry" headers="d155746e168" data-title="Description">Represents the type and description for the assignment rule.
              </td>

            </tr>

          </tbody>

        </table>

## RuleEntry

Represents the fields used by the rule.

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



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

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

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

            </tr>

          </thead>

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

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

              <td class="entry" headers="d155746e278" data-title="Description">The name of the user or queue the item is assigned to. </td>

            </tr>

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

              <td class="entry" headers="d155746e275" data-title="Field Type">
                <span class="keyword parmname">AssignToLookupValueType</span> (enumeration of type
                string)
              </td>

              <td class="entry" headers="d155746e278" data-title="Description">Valid values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">User</samp></li>

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

                </ul>
              </td>

            </tr>

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

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

              <td class="entry" headers="d155746e278" data-title="Description">Advanced filter conditions that were specified for the rule.
              </td>

            </tr>

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

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

              <td class="entry" headers="d155746e278" data-title="Description">The items in the list that define the assignment criteria.
              </td>

            </tr>

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

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

              <td class="entry" headers="d155746e278" data-title="Description">The validation formula.
                <p class="p">Specify either <span class="keyword parmname">formula</span> or
                  <span class="keyword parmname">criteriaItems</span>, but not both fields.
                </p>

              </td>

            </tr>

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

              <td class="entry" headers="d155746e275" data-title="Field Type">boolean</td>

              <td class="entry" headers="d155746e278" data-title="Description">Specifies whether email addresses included on the Cc line of an
                incoming Email-to-Case or Web-to-Lead message are included on the Cc
                line of the auto-response to that message (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). Available in API version 32.0 and later.</td>

            </tr>

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

              <td class="entry" headers="d155746e275" data-title="Field Type">boolean</td>

              <td class="entry" headers="d155746e278" data-title="Description">Specifies whether the case team resets when the assignment is
                done <samp class="codeph java">true</samp>) or if the current team
                is added to the case instead of replacing the previous team (<samp class="codeph java">false</samp>).</td>

            </tr>

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

              <td class="entry" headers="d155746e275" data-title="Field Type">string[]</td>

              <td class="entry" headers="d155746e278" data-title="Description">The name of the case team. It can occur 0 or more times. </td>

            </tr>

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

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

              <td class="entry" headers="d155746e278" data-title="Description">Specifies the template to use for the email that is automatically
                sent to the designated recipient. <p class="p">Lightning email templates
                  aren’t packageable. We recommend using a Classic email
                  template.</p>
              </td>

            </tr>

          </tbody>

        </table>

## Declarative Metadata Sample Definition

The following is an example file showing two assignment rules on the Case object:

<AssignmentRules xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <assignmentRule\>
        <fullName\>samplerule</fullName\>
        <active\>false</active\>
        <ruleEntry\>
            <assignedTo\>testUser@org.com</assignedTo\>
            <assignedToType\>User</assignedToType\>
            <criteriaItems\>
                <field\>Case.IsEscalated</field\>
                <operation\>equals</operation\>
                <value\>True</value\>
            </criteriaItems\>
            <template\>emailtemplate</template\>
        </ruleEntry\>
    </assignmentRule\>
    <assignmentRule\>
        <fullName\>Another samplerule</fullName\>
        <active\>false</active\>
        <ruleEntry\>
            <assignedTo\>otherUser@org.com</assignedTo\>
            <assignedToType\>User</assignedToType\>
            <criteriaItems\>
                <field\>Case.IsEscalated</field\>
                <operation\>equals</operation\>
                <value\>False</value\>
            </criteriaItems\>
            <template\>emailtemplate</template\>
        </ruleEntry\>
    </assignmentRule\>
</AssignmentRules\>

## 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.").