Queue defines a holding area for records awaiting processing. It combines supported object types, membership selections, hierarchy-based sharing, email notification settings, and an optional Omni-Channel routing configuration.
Supported objects and membership are separate concerns: selecting users, groups, or roles does not declare which objects the queue can hold. Queue metadata is also distinct from the runtime Group record used to identify the queue as a record owner and the QueueSObject records that associate it with supported objects.
Key Elements
| Element | What the Element Controls |
|---|---|
name |
Required queue label, shown as Label in the user interface. Do not confuse it with a developer name or record ID. |
doesIncludeBosses |
Required boolean corresponding to Grant Access Using Hierarchies. When true, records shared with queue users are also shared with users higher in the role hierarchy. |
doesSendEmailToMembers |
Whether queue members receive emails when a new record is added to the queue: true or false. |
email |
The queue owner's email address. This is a notification setting, not a membership or routing control. |
queueMembers |
Contains membership selections. These can identify individual users, public groups, roles, or role hierarchies rather than enumerate every effective member. |
queueMembers.users.user |
Identifies a directly selected user by username, not by user record ID. |
queueMembers.publicGroups.publicGroup |
Selects a public group represented by Group metadata. |
queueMembers.roles.role |
Selects a role represented by Role metadata. |
queueMembers.roleAndSubordinates.roleAndSubordinate |
Selects a role and its subordinate hierarchy, including customer and partner roles. Availability depends on Digital Experiences and external account-role configuration. |
queueMembers.roleAndSubordinatesInternal.roleAndSubordinateInternal |
Selects a role and its subordinate hierarchy while excluding customer and partner roles. |
queueRoutingConfig |
Names a separate QueueRoutingConfig component for an org using Omni-Channel with a routing configuration. |
queueSobject.sobjectType |
Declares a supported entity. Documented values include Case, ContactRequest, Lead, ServiceContract, Task, and custom-object API names such as ObjA__c. A queue can contain multiple queueSobject entries. |
Behavior and Constraints
Supported objects and metadata access. A single queue can support multiple object types. Support for ServiceContract requires Entitlements to be enabled. Access to the Queue metadata type is limited to authenticated internal and external users; this restriction is separate from access to records owned by a queue.
Membership is a selection, not a fixed user list. Effective membership depends on current public-group membership, role assignments, and role-hierarchy structure, as well as directly listed usernames. A change to a selected group or role can therefore change the effective user population without changing the queue's directly listed users.
roleAndSubordinates.roleAndSubordinate is available only when Digital Experiences is enabled and Experience Cloud site users have external account roles other than a shared person account role. The roleAndSubordinatesInternal.roleAndSubordinateInternal selection excludes customer and partner roles.
Hierarchy sharing and subordinate membership do different jobs. doesIncludeBosses controls upward sharing to users higher in the role hierarchy. A role-and-subordinates selection controls downward membership scope. Setting doesIncludeBosses to false does not establish that higher-role users lack access through every other sharing mechanism.
Queue ownership is not ownership by its members. An owner-based sharing rule selecting a queue concerns records owned by that queue, not records owned by its individual members. A 2024 community explanation also confirmed that shared membership between two queues does not make their ownership-based sharing scopes interchangeable. The wording "Owner in Queue" can obscure this distinction.
Routing configuration is separate from queue configuration. The queue supplies membership and supported-object context; queueRoutingConfig points to a separate routing component. A configured queue and routing configuration alone do not demonstrate that agents can receive Omni-Channel work. A reported custom-object routing case also required a Presence Status associated with the matching Service Channel.
Notifications do not grant access or enable routing. doesSendEmailToMembers controls member emails when a record is added, while email stores the queue owner's email address. Neither setting replaces membership, supported-object, sharing, or routing configuration.
Deployment and Retrieval
Queue components use the .queue file suffix and reside in the queues directory of the package directory. The Queue type supports * in the package.xml manifest, allowing retrieval of all queues.
Preserve retrieved membership references. Retrieved public-group and role membership references use DeveloperName, not display Name. Retrieval can append letters to disambiguate duplicate names. Preserve those returned reference values rather than reconstructing them from labels. Direct user membership uses usernames, so these entries are not portable user record IDs.
Referenced components remain separate assets. A queue can refer to public groups, roles, supported custom objects, and a routing configuration. Its metadata does not contain those components' definitions. Incoming references from assignment, escalation, sharing, workflow, bot, messaging, and other configuration also matter when changing or replacing a queue.
Runtime assignment needs the queue's owner identity. For Flow assignment, a community-reported approach uses Get Records on the runtime Group object with Type = 'Queue' and DeveloperName equal to the queue developer name, then assigns the returned Id to OwnerId. This avoids embedding a source org's queue ID. A QueueSObject record's Id identifies the supported-object association, not the queue owner.
Post-migration routing errors can come from Flow. A report of "The queue isn't valid for this object type" traced the failure to an Omni-Channel Flow action retaining source-org serviceChannelId and queueId values. Recreating the action resolved that case; changing the queue's supported objects was not the reported remedy.
Relationships
Outgoing references identify membership, supported custom objects, and routing configuration. Incoming references identify places that can assign work, share records, route sessions, or otherwise select a queue. These are possible schema connections, not proof that a particular queue is used by every listed type. Container and nested-definition references are both listed where applicable.
Queue.queueRoutingConfig and QueueRoutingConfig.queueOverflowAssignee have opposite directions. The queue used as an overflow assignee need not be the queue that names that routing configuration.
References
-
Group:publicGroup. -
Role:role,roleAndSubordinate,roleAndSubordinateInternal. -
CustomObject:sobjectType, when a custom-object API name is selected. -
QueueRoutingConfig:queueRoutingConfig.
Referenced By
-
ApprovalProcess:name. -
AssignmentRules:assignedTo. -
AssignmentRule:assignedTo. -
EscalationRules:assignedTo. -
EscalationRule:assignedTo. -
Workflow:lookupValue. -
WorkflowFieldUpdate:lookupValue. -
SharingRules:queue. -
SharingCriteriaRule:queue. -
SharingGuestRule:queue. -
SharingOwnerRule:queue. -
SharingTerritoryRule:queue. -
CustomObject:queue. -
ListView:queue. -
Bot:sourceName. -
BotVersion:sourceName. -
BotBlock:sourceName. -
BotTemplate:sourceName. -
MessagingChannel:sessionHandlerQueue. -
CallCenter:voiceMailFallbackQueue. -
CallCenterRoutingMap:referenceRecord. -
OmniSupervisorConfig:queue. -
QueueRoutingConfig:queueOverflowAssignee.
Documentation Inconsistencies
- The type overview lists cases, leads, service contracts, and custom objects, while the
sobjectTypefield definition also listsContactRequestandTask. Do not treat the shorter overview as the complete documented value list. - The official membership XML sample uses
queueRoleAndSubordinatesandqueueRoleAndSubordinate, while the field definitions exposeroleAndSubordinatesandroleAndSubordinate. The sample also repeats an openingpublicGroupstag where a closing tag is needed. Do not copy that sample unchanged as deployable XML.
Reported Issues
- Queue-based sharing did not expand to members' owned records. A 2024 explanation confirmed that an owner-based rule selecting a queue shares only records owned by that queue. A user belonging to two queues did not cause one queue's records to fall under the other's ownership-based rule. See the queue ownership sharing explanation.
-
Flow assignment could avoid hard-coded queue IDs. An approach reported in 2020 and updated in 2023 retrieved
GroupusingType = 'Queue'and the queue'sDeveloperName, then used itsIdfor ownership. See the dynamic queue lookup in Flow. -
Case assignment failed with
FIELD_INTEGRITY_EXCEPTIONwhen given the association ID. In a 2014 Apex test, assigning aQueueSObjectrecord'sIdtoCase.OwnerIdcaused an incorrect-ID-type error. Using the queue'sGroup.Idresolved that problem. See the Case owner ID correction. -
Apex queue setup could expose a separate mixed-DML failure. The same 2014 test discussion reported
MIXED_DML_EXCEPTIONwhile creating queue support and Case records. The answer isolated theQueueSObjectinsertion withSystem.runAs(...). This was a test-data setup issue, not a Queue metadata deployment error. See the queue test setup workaround. -
A direct-membership query could miss an effective queue member. A 2016 answer reported that filtering
GroupMemberby a user'sUserOrGroupIdandGroup.Type = 'Queue'did not find membership inherited through a public group. A result with no rows therefore did not establish that the user was outside the queue. See the direct versus indirect membership query. - Omni-Channel work was not offered until Presence Status was connected. In a 2022 custom-object queue-based routing case, queue members and routing configuration were already configured. Associating a Presence Status with the matching Service Channel resolved the missing work offers. See the Presence Status routing fix.
- A Chat availability check failed despite Case support. In a 2023 report, the Flow action checked the Chat Service Channel. Adding Chat Transcript to the queues' supported objects reportedly resolved "The queue isn't valid for this object type." See the Chat channel object mismatch.
-
A migrated Flow retained source-org routing IDs. A 2024 report traced the same queue-validity error to retained
serviceChannelIdandqueueIdvalues in an Omni-Channel Flow action. Deleting and recreating the action resolved that case. See the migrated routing action report.
Common Questions
How do I retrieve all Salesforce queues with Metadata API?
Use the Queue metadata type with * in package.xml. Queue components use the .queue suffix and are stored in the queues directory.
Why doesn't queueMembers contain every user in the queue?
queueMembers can select public groups, roles, and role hierarchies instead of listing individual usernames. Effective membership depends on those selections' current users. Direct-user GroupMember queries can also miss indirect membership.
Is Grant Access Using Hierarchies the same as adding a role and subordinates?
No. doesIncludeBosses controls upward record sharing to higher-role users. Role-and-subordinates selections control downward membership scope. A false hierarchy-sharing setting does not rule out access through other sharing mechanisms.
Which queue ID should Flow or Apex use for Case OwnerId?
Use the runtime queue's Group.Id, not a QueueSObject.Id. The reported Flow approach retrieves Group with Type = 'Queue' and the queue's DeveloperName.
Why does Omni-Channel say the queue isn't valid after deployment?
Reported causes include a mismatch between the checked Service Channel and the queue's supported objects, or a migrated Flow action retaining source-org serviceChannelId and queueId values. Separately, missing work offers can result from a Presence Status not being associated with the matching Service Channel.