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 use 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>

Parent Type 

This type extends Metadata and inherits its fields.

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 

Introduced in API version 27.0.

Fields 

assignmentRule 

  • Type: AssignmentRule[]
  • Required: No
  • Description: Represents the definitions of the named assignment rules.

AssignmentRule Type 

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

Parent Type 

This type extends Metadata and inherits its fields.

Fields 

active 

  • Type: boolean
  • Required: No
  • Description: Indicates whether the assignment rule is active (true) or not (false).

fullName 

  • Type: string

  • Required: No

  • Description: 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 

  • Type: RuleEntry[]
  • Required: No
  • Description: Represents the type and description for the assignment rule.

RuleEntry Type 

Represents the fields used by the rule.

Fields 

assignedTo 

  • Type: string
  • Required: No
  • Description: The name of the user or queue the item is assigned to.

assignedToType 

  • Type: AssignToLookupValueType (enumeration of type string)
  • Required: No
  • Description: Valid values are: User Queue
  • Possible values:
    • User
    • Queue

booleanFilter 

  • Type: string
  • Required: No
  • Description: Advanced filter conditions that were specified for the rule.

businessHours 

  • Type: string
  • Required: No

businessHoursSource 

  • Type: BusinessHoursSourceType (enumeration of type string)
  • Required: No

criteriaItems 

  • Type: FilterItem[]
  • Required: No
  • Description: The items in the list that define the assignment criteria.

disableEscalationWhenModified 

  • Type: boolean
  • Required: No

escalationAction 

escalationStartTime 

  • Type: EscalationStartTimeType (enumeration of type string)
  • Required: No

formula 

  • Type: string

  • Required: No

  • Description: The validation formula.

    Specify either formula or criteriaItems, but not both fields.

notifyCcRecipients 

  • Type: boolean
  • Required: No
  • Introduced: API version 32.0
  • 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 (true) or not (false).

overrideExistingTeams 

  • Type: boolean
  • Required: No
  • Description: Specifies whether the case team resets when the assignment is done true) or if the current team is added to the case instead of replacing the previous team (false).

replyToEmail 

  • Type: string
  • Required: No

senderEmail 

  • Type: string
  • Required: No

senderName 

  • Type: string
  • Required: No

team 

  • Type: string[]
  • Required: No
  • Description: The name of the case team. It can occur 0 or more times.

template 

  • Type: string

  • Required: No

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