What happens when you try to delete a queue?

Overview

Deleting a queue in Salesforce removes the queue definition but has important consequences for records, ownership, and automation. This post explains what Salesforce does when you delete a queue, common failure scenarios, and recommended safe steps to remove a queue without data loss or unexpected behavior.

How Salesforce stores queues

Queues are represented by Group and QueueSobject records in Salesforce. The Group object stores the queue identity (Type = ‘Queue’) and the QueueSobject object maps which sObjects (e.g., Case, Lead, CustomObject__c) the queue can own. A queue appears in the OwnerId field on objects the same way a user or public group does — the OwnerId points to the Group Id.

What happens when you delete a queue

When you delete a queue using Setup (or via Metadata/API), Salesforce deletes the Group and related QueueSobject metadata for that queue. However, Salesforce does not automatically reassign records owned by the deleted queue. Records that had the queue as OwnerId will still reference that Group Id, which now points to a deleted/removed group. Practically this means:

  • Records remain in the database with the same OwnerId value, but the Owner no longer resolves to an active queue in the UI.
  • Standard UI may show the owner as blank or show the previous queue name as non-clickable text (behavior can vary by release).
  • Workflows, assignment rules, and automation that expected the queue may stop working until owners are reassigned.

Common errors and blocking conditions

Salesforce may prevent deletion of a queue in certain cases:

  • Queue tied to active assignment rules or case auto-assignment where the queue is referenced — check and remove references first.
  • Queue used as default record owner in some automation or integrations — ensure no active process expects the queue to exist.
  • Queues that are used as an entry in entitlement, escalation, or support setups could require cleanup.

What happens to queue members and email routing?

Deleting a queue removes membership definitions stored for that queue (users and public groups added as members). Email-to-case routing or email notifications that used the queue’s email address (if configured) will be impacted — the queue-level email handling will no longer work. If the queue had an email address used for case creation, verify the email routing before deleting.

How to safely delete a queue (recommended steps)

Follow these steps to avoid orphaned records and broken processes:

  1. Identify all sObjects the queue owns: use QueueSobject and Group queries.
  2. Find records assigned to the queue and reassign them to another owner (user or another queue).
  3. Remove the queue from assignment rules, workflows, Process Builder/Flow, validation rules, and integrations.
  4. Disable or update email-to-case and routing addresses that point to the queue.
  5. Once no references remain and records are reassigned, delete the queue from Setup or via Metadata/API.

Useful queries and Apex snippet

Find the queue’s Group Id and which objects it can own:

SELECT Id, Name FROM Group WHERE Type = 'Queue' AND Name = 'Support' LIMIT 1
SELECT Id, QueueSobjectId FROM QueueSobject WHERE QueueId = '<GroupId>'

Find records owned by a queue (example for Case):

SELECT Id, OwnerId, Subject FROM Case WHERE OwnerId = '<GroupId>'

Simple Apex snippet to reassign cases from a queue to a user:

Id newOwnerId = '005xxxxxxxxxxxx'; // user id
List cases = [SELECT Id FROM Case WHERE OwnerId = :queueGroupId LIMIT 1000];
for (Case c : cases) c.OwnerId = newOwnerId;
update cases;

Post-delete checks

After deleting a queue, confirm:

  • There are no orphaned records with non-resolving OwnerId values.
  • Reports, dashboards, and list views referencing the queue are updated.
  • Automations and integrations formerly targeting the queue are re-pointed.

Summary

Deleting a queue removes its metadata and membership, but records that had the queue as owner are not automatically reassigned. Always reassign records and remove references before deletion to avoid orphaned records and broken automation. Use SOQL, Data Loader, or Apex to find and update records safely.