Queues and public groups

From PranavNagrecha/AwesomeSalesforceSkills · View interactive version

Queues and public groups is an AI agent skill from the GitHub repository PranavNagrecha/AwesomeSalesforceSkills. Use this skill when creating or managing queues, configuring queue membership, setting up case or lead queues, creating public groups, or using groups in sharing rules and manual sharing. Trigger keywords: queue, public group, queue membership, queue email, group sharing, case queue, lead queue. NOT

How to use this skill

Skill file

Queues and Public Groups

This skill activates when an admin needs to create or manage queues (which own records and route work to teams) or public groups (which aggregate members for access sharing, sharing rules, and list view visibility). Use it alongside the assignment-rules skill when records must be routed to queues automatically.


Before Starting

Gather this context before working in this domain:


Questions to Ask Before Configuring

| Ask | Why it matters | What a good answer adds |

|---|---|---|

| "Who works this pool, and how does that list change?" | Named users churn; roles and public groups maintain themselves | Membership that survives onboarding and offboarding |

| "Which objects will the queue own?" | A queue owns only the objects in queueSobject; rules and Omni-Channel targeting it for another object fail | One queue per work pool |

| "Who should be notified of a new record: shared mailbox, every member, nobody?" | email and doesSendEmailToMembers are independent switches | A notification people read instead of filter |

| "Is Omni-Channel pushing from this queue?" | Without a routing configuration the queue is a list view | The link into the routing stack |

| "What happens to queue-owned records when the queue is retired?" | Records are stranded | A retirement step in the runbook |

A proper queue adds a pool that follows the org chart, a notification channel someone reads, manager visibility by design, and a routing target every rule can name by developer name. Full matrix: references/queue-behaviour-matrix.md.


Core Concepts

Queues

A queue is a special type of record owner that represents a pool of users, rather than a single individual. Records assigned to a queue are visible to all queue members through the queue's list view. Any queue member can claim ownership by changing the record's Owner field to themselves.

Supported objects for queues: Case, Lead, Order, and custom objects where "Allow Queues" is checked on the object definition. Account, Contact, Opportunity, and most other standard objects do not support queue ownership.

Queue membership types: A queue can include individual Users, Roles, Roles and Internal Subordinates, and Public Groups. Adding a Role automatically includes all users in that role; Roles and Internal Subordinates also includes users in roles below it in the hierarchy, internal users only. This group was labelled "Roles and Subordinates" before the Secure Roles release update — see references/gotchas.md Gotcha 6 before writing metadata or SOQL against it.

Queue email: Each queue can have a single email address (individual address or distribution list). When a record is assigned to the queue, Salesforce sends a notification to that address. Individual queue members do not receive individual email notifications — only the queue email is triggered. Configure this address to reach the whole team, not a single person.

Accepting work from a queue: Queue-owned records are in a shared pool. A team member claims a record by changing the Owner field to themselves. Until claimed, the owner remains the queue. Records owned by a queue appear in list views scoped to that queue, not in any individual's "My Open Cases" or "My Leads" view.

SOQL for queue-owned records: Use WHERE Owner.Type = 'Queue' to filter records owned by any queue. To filter by a specific queue name: WHERE Owner.Name = 'Tier 1 Support Queue'. Note that OwnerId alone does not distinguish user-owned from queue-owned records — Owner.Type is required.

Public Groups

A public group is a named collection of members used to grant access and control visibility. Unlike a queue, a public group does not own records — it only aggregates membership for sharing purposes.

Member types a public group can include: Users, Roles, Roles and Internal Subordinates, other Public Groups, and Portal Users (Customer Portal or Partner Portal users when Communities/Experience Cloud is enabled). This composition flexibility allows a single group to span organizational boundaries.

Uses of public groups:

Nested groups: Public groups can contain other public groups. Nesting allows hierarchical structures but increases the cost of sharing recalculation. Every membership change triggers Salesforce to recompute all sharing rows for all objects with sharing rules that reference the group. In orgs with millions of records and complex group nesting, this recalculation can lock objects for extended periods. Flat group membership (direct users and roles) is preferred in high-volume orgs.

Queues vs Public Groups

These two constructs serve different purposes and should not be substituted for each other:

| Aspect | Queue | Public Group |

|---|---|---|

| Can own records | Yes — record OwnerId can be a Queue Id | No — groups cannot own records |

| Supported objects | Case, Lead, Order, queue-enabled custom objects | Any object (for sharing, not ownership) |

| Used for sharing rules | No (indirectly — as queue member) | Yes — primary use case |

| Used for routing work | Yes — primary use case | No |

| Sends queue email notification | Yes — single address per queue | No |

| Member types | Users, Roles, Roles + Internal Subordinates, Groups | Users, Roles, Roles + Internal Subordinates, Groups, Portal Users |


Common Patterns

Pattern: Tiered Support Queues with Escalation

When to use: A support team handles cases at multiple levels of complexity. Tier 1 agents handle general inquiries; Tier 2 specialists handle complex or escalated cases. Records should enter Tier 1 first and escalate to Tier 2 when needed.

How it works:

  1. Create a queue named Tier 1 Support for the Case object. Add Tier 1 agents as members. Configure a queue email (e.g., support-t1@company.com).
  2. Create a queue named Tier 2 Support for the Case object. Add Tier 2 specialists as members. Configure a separate queue email.
  3. Configure a Case Assignment Rule (see assignment-rules skill) to route new cases to Tier 1 Support.
  4. Use an Escalation Rule or a Flow to detect when a case has been open in Tier 1 too long, then change the Owner to Tier 2 Support.
  5. Tier 2 agents see the escalated case in their queue list view and claim ownership.

Why not assign directly to a user: Queue-based routing allows any available team member to claim work, preventing bottlenecks when a specific agent is unavailable.

Pattern: Regional Public Group for Sharing Rules

When to use: Sales reps in EMEA need read access to Opportunities owned by other EMEA reps, but the org-wide default for Opportunity is Private. Assignment-rules would not solve this — the reps still need cross-user read access without changing ownership.

How it works:

  1. Create a public group named EMEA Sales Team. Add all EMEA sales users directly, or add the EMEA Sales Role to include all role members automatically.
  2. Navigate to Setup → Sharing Settings → Opportunity Sharing Rules → New.
  3. Select rule type: Ownership-based. "Owned by members of" → EMEA Sales Team. "Share with" → EMEA Sales Team. Access: Read Only.
  4. Salesforce recalculates sharing and grants all EMEA reps read access to each other's Opportunities.
  5. When a new rep joins EMEA, add them to the group (or the role) and sharing is automatically extended.

Why not use a Role hierarchy: Role hierarchy grants upward visibility (managers see subordinates' records) but not peer visibility. A sharing rule with a public group grants horizontal access among peers in the group.


Decision Guidance

| Situation | Recommended Approach | Reason |

|---|---|---|

| Route Cases or Leads to a team pool | Queue on Case or Lead object | Queues own records; team members claim from shared pool |

| Grant read/write access to a group of users | Public Group + Sharing Rule | Groups aggregate membership; sharing rules grant access |

| Custom object needs team-based ownership | Enable queues on object, then create queue | Custom objects require explicit queue enablement in Setup |

| Need to share a Salesforce list view with a team | Public Group (assign list view to group) | List view visibility is controlled by public group membership |

| Email a team when a record is assigned | Queue email on the queue | Single address notified on queue assignment |

| Email an entire team from a Flow email alert | Public Group as alert recipient | Email alerts can target public groups, reaching all members |

| Object is Account, Contact, or Opportunity | Public Group (for sharing rules) only | These objects do not support queue ownership |

| Member changes cause slow sharing recalculation | Flatten group structure, reduce nesting depth | Each nested group multiplies recalculation scope |


Recommended Workflow

Step-by-step instructions for an AI agent or practitioner working in this domain:

  1. Clarify the goal — determine whether the need is record routing (queue) or access sharing (public group). Confirm which object is involved and whether it supports queues.
  2. Create the queue or public group in Setup — for queues: Setup → Queues → New; configure supported objects, queue email, and members. For groups: Setup → Public Groups → New; add members by type (user, role, group).
  3. Configure downstream use — for queues: set up an assignment rule or Flow to route records to the queue. For public groups: create a sharing rule that references the group, or assign list views to the group.
  4. Validate membership — confirm all intended users are reachable through the membership chain (direct, via role, or via nested group). Deactivated users should be removed from queue membership to avoid stale ownership pools.
  5. Test the queue email — assign a test record to the queue and confirm the queue email receives a notification.
  6. Run the checker script — python3 skills/admin/queues-and-public-groups/scripts/check_queues.py --manifest-dir <metadata-dir> to surface any Group metadata references for review, including sharing rules still using the pre-Secure-Roles <roleAndSubordinates> element. It recurses, so --manifest-dir can be the project root or a build root and it still finds every queues/ and groups/ directory beneath. Exit 1 is an ERROR (a file that will not parse); queue-configuration findings are WARNs that exit 0 unless you add --strict.
  7. Confirm SOQL uses Owner.Type — any report or query on queue-owned records must use Owner.Type = 'Queue'; plain OwnerId checks will not distinguish queues from users.

Review Checklist

Run through these before marking queue or public group configuration complete:


Salesforce-Specific Gotchas

Non-obvious platform behaviors that cause real production problems:

  1. Queue-owned records show queue name as Owner in reports — Owner Name, Owner Email, and Owner Role fields reflect the queue, not a user. Reports grouped by Owner or dashboards using Owner-based filters will show the queue name as a row, separate from any user's data. Rollup summaries and assignment-based reports may undercount or misattribute records until ownership is accepted by a user.
  2. Deleting a queue does not reassign records — If a queue is deleted while it still owns records, those records become unowned or orphaned in some report contexts. Reassign all queue-owned records to a user or another queue before deleting a queue. Use a SOQL query (WHERE Owner.Name = 'Queue Name') to find affected records first.
  3. "Roles and Subordinates" was renamed to "Roles and Internal Subordinates" — the Secure Roles release update changed the default role-hierarchy sharing group so that enabling Digital Experiences no longer exposes those records to external site users. Enforced in sandboxes in Summer '25, and in production in Winter '26 — but production enforcement was scoped to orgs created after 8 February 2024 that had not enabled digital experiences, so an older org may still show the old label until it takes the release update. Check Setup → Release Updates in the target org first. Metadata <sharedTo><roleAndSubordinates> becomes <roleAndSubordinatesInternal>, and SOQL/API references to the RoleAndSubordinates group become RoleAndSubordinatesInternal. Salesforce translates old references dynamically for a transition period only; manual updates are still required. See references/gotchas.md Gotcha 6.
  4. Deactivated users remain in queue membership until removed — Salesforce does not auto-remove deactivated users from queues. The queue still accepts assignments, still shows the deactivated user in its membership list, and still sends queue email to the configured address. This causes confusion when teams assume the membership is clean. Audit queue membership during every user deactivation.

Output Artifacts

| Artifact | Description |

|---|---|

| Configured queue | Queue with supported objects, queue email, and verified membership |

| Configured public group | Named group with correct member composition for its intended sharing or visibility use |

| Sharing rule | Criteria-based or ownership-based rule referencing the public group |

| SOQL pattern | WHERE Owner.Type = 'Queue' filter for queue-owned record queries |

| Checker script output | List of Group metadata references found in the project metadata for review |


Reference Files

| File | Read it when |

|---|---|

| references/queue-behaviour-matrix.md | Choosing membership sources, objects, notifications, and visibility, with the questions to ask first |

| references/metadata-examples.md | Writing deployable Queue and Group XML and the package.xml for them |

| references/gotchas.md | The six behaviours that cause most queue incidents |


Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.