AssignmentRule defines a named record-routing rule, including its activation state, matching conditions, and destination user or queue. Case assignment entries can also apply case teams and select notification email templates.
AssignmentRule is the named child of the object-level AssignmentRules container, not the container itself. It is also distinct from the runtime AssignmentRule sObject, whose record ID can select a rule for a record operation. A metadata name such as Case.samplerule is not that runtime record ID.
Key Elements
The routing and notification elements below are inside ruleEntry, except for fullName, active, and ruleEntry itself.
| Element | What the Element Controls |
|---|---|
fullName |
The rule's name. Inside the object's container, this is the local name, such as samplerule. It cannot be null and is required when creating, updating, or deleting the rule. |
active |
Whether the rule is active: true or false. This does not by itself determine whether a particular record operation invokes assignment rules. |
ruleEntry |
The collection of entries that define matching conditions, destinations, and related assignment actions. |
assignedTo |
The name of the destination user or queue. Interpret it together with assignedToType; it is not the runtime assignment-rule record ID. |
assignedToType |
The destination type. The exact allowed values are User and Queue. |
criteriaItems |
Field-based assignment criteria. Each item identifies a field, an operation, and a comparison value. Do not specify it together with formula. |
booleanFilter |
Advanced filter logic for combining criteria-based conditions. |
formula |
A formula used to determine whether the routing entry matches. Specify either this element or criteriaItems, not both. |
overrideExistingTeams |
For case assignment, true resets or replaces the case team; false adds the specified team rather than replacing the previous team. |
team |
The case-team names to apply. The element supports zero or more names, not just one. |
template |
The email template used for the automatic notification. Lightning email templates are not packageable; use a Classic email template for packaged definitions. |
notifyCcRecipients |
Whether Cc addresses from an incoming Email-to-Case or Web-to-Lead message are copied on its auto-response. This changes notification recipients, not ownership selection. |
Behavior and Constraints
Rules are processed in the order they appear within the AssignmentRules container. Keep this container-level ordering separate from activation and runtime invocation: active records the rule's activation state, while the options on a record operation determine whether assignment rules are invoked.
assignedTo and assignedToType form a pair. A queue name must be interpreted as a queue destination, and a user name as a user destination. The supported destination types remain User and Queue, even when a schema representation shows other associations through assignedTo.
Use either a routing formula or field-based criteria for an entry. Although the field documentation calls formula a "validation formula," it is a routing condition here, not a separate validation rule that rejects a record save. For criteria-based entries, booleanFilter supplies the advanced condition logic.
Case-team changes depend on both team and overrideExistingTeams. A scalar-string representation of team in some schema views is a cardinality discrepancy: the documented element can occur zero or more times. It does not impose a one-team limit.
The broader RuleEntry schema includes escalation-related members, such as business-hours and escalation-action settings. Their presence in a shared schema does not establish escalation behavior for AssignmentRule.
Ownership assignment and notification delivery are separate outcomes. A matching entry can select a destination and a notification template, but runtime email options can still affect whether a notification is sent.
Deployment and Retrieval
Choose the manifest type and member according to the scope you need:
- For one named rule, use type
AssignmentRulewith an object-qualified member such asCase.samplerule. - For every assignment rule on Case, use type
AssignmentRuleswith memberCase. - For assignment rules across all applicable objects, use type
AssignmentRuleswith member*.
Object-level files use the .assignmentRules suffix and reside in the assignmentRules folder. For example, the Case collection is stored in assignmentRules/Case.assignmentRules. Within that container, the child's fullName is the local rule name, not the object-qualified manifest member. These scopes are described in the Salesforce Metadata API reference.
A non-null fullName is required for create, update, and delete operations. Do not substitute a runtime assignment-rule record ID for the metadata name.
Review dependencies from the actual entries being moved. criteriaItems.field can refer to a custom field, formula can contain custom-field references, assignedTo can identify a queue, and template identifies an email template. Case-team names are additional configuration associations. Changing any of these values can change what the entry does; possible schema connections alone do not establish a mandatory deployment sequence.
For packaged definitions, use Classic email templates. Lightning email templates are not packageable, even though template is exposed as a string.
Relationships
The relationships that affect routing are the fields used to match records, the selected destination, and the notification template. The parent container determines the object's collection of named rules. Case-team names are configuration associations rather than additional assignee types.
References
-
CustomField:fieldwithincriteriaItems, and embedded references informula. -
Queue:assignedTo, whenassignedToTypeisQueue. -
EmailTemplate:template. The shared schema also exposes template associations throughassignedToTemplateandnotifyToTemplate; these escalation-related members do not establish escalation behavior for this type.
An additional schema association connects assignedTo with CustomObject. This does not introduce an object-based assignee type: the documented destination choices remain User and Queue.
Referenced By
-
AssignmentRules:assignmentRule, the collection of named child rules.
Reported Issues
-
An external-user query failure can concern runtime access, not the metadata definition. In a 2026 Experience-user report, querying the active Case rule failed with "sObject type 'AssignmentRule' is not supported" in a
with sharingclass but succeeded withwithout sharing. A reply suggestedassignmentRuleHeader.useDefaultRule=truewhen only the active/default Case rule was needed, avoiding the ID query. This report is not a general reason to remove sharing enforcement. External-user query discussion. -
A REST integration can invoke assignment rules without explicitly selecting one. An answer in a 2014 discussion reports that
Sforce-Auto-Assignenables or disables active rules, accepts a validAssignmentRuleID to select a rule, and defaults to using active rules when omitted from Case or Lead requests. This is a possible explanation for unexpected ownership changes from an integration. REST assignment-header discussion. -
Setting assignment options in a trigger can be too late for the operation already running. In a 2022 Lead-trigger discussion, the accepted answer reports that rule selection is fixed when the DML operation starts. DML means a database write, such as insert or update. The answer recommends passing options to
Database.update(records, dmlOptions)for a subsequent operation and explicitly controlling recursion so the update does not repeatedly invoke itself. It does not establish that asynchronous execution is always required. Lead-trigger timing discussion. -
Successful queue assignment does not prove that notification email was sent. In a 2012 Apex Case-insert report, a rule with a notification template assigned the Case to the intended queue but did not notify members until
Database.DMLOptions.emailHeader.triggerUserEmailwas enabled. The reported fix concerned Apex DML options, not a metadata-only email guarantee. Queue-notification discussion. -
A rule name can cause a bad-ID error in Data Loader. A 2017 Lead-import report traced the failure to entering an assignment-rule name in the Assignment Rule setting, which expected the rule's record ID. Neither the metadata
fullNamenor an object-qualified manifest member is that ID. Data Loader rule-ID discussion.
Common Questions
How do I retrieve just one assignment rule?
Use manifest type AssignmentRule with an object-qualified member such as Case.samplerule. Use AssignmentRules with member Case when you want the object's whole collection.
Why does an active assignment rule not run from Apex?
active and runtime invocation are separate. The record operation must invoke assignment rules. The reported Lead-trigger behavior also shows that setting options after the current DML operation has started can be too late for that operation.
Should I use the assignment-rule name or ID in Data Loader?
The Assignment Rule setting in the reported Data Loader case expected the runtime record ID. The local fullName and object-qualified metadata member are deployment identities, not runtime IDs.
Why did the Case move to a queue without sending email?
Assignment and notification are separate outcomes. In the reported Apex insert case, the rule had a notification template, but queue-member notifications required emailHeader.triggerUserEmail to be enabled in the DML options.
Can an assignment-rule entry apply more than one case team?
Yes. team supports zero or more names. overrideExistingTeams=true resets or replaces the case team, while false adds the specified team rather than replacing the previous team.