Newer Version Available

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

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:
1<types>
2        <members>*</members>
3        <name>AssignmentRules</name>
4    </types>
All rules for a specific object uses a similar syntax without the wildcard. For example, all assignment rules for the Case object would use this syntax:
1<types>
2        <members>Case</members>
3        <name>AssignmentRules</name>
4    </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.
1<types>
2        <members>Case.samplerule</members>
3        <members>Case.newrule</members>
4        <name>AssignmentRule</name>
5    </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[] 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.

Field Name Field Type Description
active boolean Indicates whether the assignment rule is active (true) or not (false).
fullname string Inherited from Metadata, this field is defined in the WSDL for this metadata type. It must be specified when creating, updating, or deleting. See createMetadata() to see an example of this field specified for a call.

This value can't be null.

ruleEntry RuleEntry[] Represents the type and description for the assignment rule.

RuleEntry

Represents the fields used by the rule.

Field Name Field Type Description
assignedTo string The name of the user or queue the item is assigned to.
assignedToType AssignToLookupValueType (enumeration of type string) Valid values are:
  • User
  • Queue
booleanFilter string Advanced filter conditions that were specified for the rule.
criteriaItems FilterItem[] The items in the list that define the assignment criteria.
formula string The validation formula.

Specify either formula or criteriaItems, but not both fields.

Note

notifyCcRecipients boolean Specifies whether email addresses included on the Cc line of an incoming Email-to-Case or Web-to-Lead message should be included on the Cc line of the auto-response to that message (true) or not (false). Available in API version 32.0 and later.
overrideExistingTeams boolean Specifies whether the case team should be reset when the assignment is done true) or if the current team is added to the case instead of replacing the previous team (false).
team string[] The name of the case team. It may occur 0 or more times.
template string Specifies the template to use for the email that is automatically sent to the designated recipient.

Lightning email templates aren’t packageable. We recommend using a Classic email template.

Declarative Metadata Sample Definition

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

1<AssignmentRules xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2    <assignmentRule>
3        <fullName>samplerule</fullName>
4        <active>false</active>
5        <ruleEntry>
6            <assignedTo>testUser@org.com</assignedTo>
7            <assignedToType>User</assignedToType>
8            <criteriaItems>
9                <field>Case.IsEscalated</field>
10                <operation>equals</operation>
11                <value>True</value>
12            </criteriaItems>
13            <template>emailtemplate</template>
14        </ruleEntry>
15    </assignmentRule>
16    <assignmentRule>
17        <fullName>Another samplerule</fullName>
18        <active>false</active>
19        <ruleEntry>
20            <assignedTo>otherUser@org.com</assignedTo>
21            <assignedToType>User</assignedToType>
22            <criteriaItems>
23                <field>Case.IsEscalated</field>
24                <operation>equals</operation>
25                <value>False</value>
26            </criteriaItems>
27            <template>emailtemplate</template>
28        </ruleEntry>
29    </assignmentRule>
30</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.