Sub topic 5
Creating and Managing Queues
This chapter assumes you know basic Salesforce navigation (Setup, objects, list views) and understand users, profiles, and permission sets. The Apex and SOQL examples are optional.
What a queue is
A queue is a shared owner for records. A case owned by a queue belongs to the team until one member accepts it. Queues hold records for a group of users, and any member can take a record from the list. Under the hood, a queue is a Group record whose Type is Queue, so its Id can go straight into a case's OwnerId.
Create a queue
- In Setup, search for Queues and click New.
- Enter a Label (for example, Tier 2 Support). The Queue Name becomes the API name, which Apex and metadata use as
DeveloperName. - Optionally set a Queue Email. Salesforce sends notifications there when a case arrives.
- Under Supported Objects, add Case. A queue can only own records of the objects you select here.
- Under Queue Members, add users, roles, or public groups.
- Save.
Who sees and takes queue cases
Membership does not grant access to the records by itself. Members still need object permissions on Case, such as Read and Edit. Record access then follows your sharing settings.
Members take a case in one of these ways:
- Open the queue list view and use Accept (or change the owner to themselves).
- Edit the case and set Case Owner to their own user.
If a user without the right permissions is a queue member, they see the queue but cannot work its cases.
How a case reaches a queue
Assignment rules (covered in the next chapter) usually place cases in queues. You can also set the owner manually, or from code:
Group tier2 = [
SELECT Id
FROM Group
WHERE Type = 'Queue' AND DeveloperName = 'Tier2_Support'
LIMIT 1
];
Case c = new Case(
Subject = 'Data export fails',
Origin = 'Email',
OwnerId = tier2.Id
);
insert c;Find cases still waiting in queues
To see which open cases nobody has picked up, query on the owner type:
SELECT Id, CaseNumber, Subject, Status
FROM Case
WHERE Owner.Type = 'Queue' AND IsClosed = false
ORDER BY CreatedDate ASCOldest first shows the cases that have waited longest.
Managing queues over time
- Review membership when people join, leave, or change teams. Using roles or public groups avoids editing users one at a time.
- Keep queues few and purposeful. Each queue should match a real working group, such as a tier or product line.
- Add a fallback queue for cases that match no assignment rule entry, so none are left without an owner.
- Remove a queue carefully. You cannot delete a queue that still owns records or is referenced by a rule. Reassign the cases and update the rules first.
Common errors
| Symptom | Likely cause |
|---|---|
| Queue is missing from the case owner lookup | Case is not listed under **Supported Objects** |
| Member sees the queue but cannot edit cases | Missing object permission on Case |
| Apex query for the queue returns no rows | Wrong `DeveloperName`, or `Type` is not `'Queue'` |
| Cases pile up in a queue | No one is a member, or members are not watching the list view |
Exercise
A new queue named "Billing" does not appear as an option when you change the owner of a case. The queue has members. What do you check first, and why?
Show answer
Check that Case is added under the queue's Supported Objects. A queue can only own records of the selected objects, so without Case it is not offered as a case owner, no matter who the members are.