Skip to main content
New tool CRON Expression Builder — preview next run times before you schedule Apex. Open the builder →
Diagram illustrating the process and impact of deleting a Salesforce queue on associated records.
Admin

Delete Salesforce queue: What happens to your records?

Deleting a queue looks like a quick admin task, and it can leave your data in a mess. Here is what happens to orphaned records, and how to clean things up without breaking your automation.

The short answer

Deleting a Salesforce queue removes the Group record and the QueueSobject mapping, and it does not reassign the records that queue owned. To avoid orphaned records and broken automation, administrators must reassign every record, update routing rules and Flows, and verify email routing before deleting the queue.

Key takeaways Reassign all records owned by a queue using Data Loader or Apex before deleting it, or those records keep an invalid OwnerId. Query the Group object and the target records with SOQL to confirm nothing is still assigned to the queue ID before deletion. Update active Case and Lead Assignment Rules, Flows, and formula fields that reference the queue to prevent deletion blocks and routing failures. Adjust Email-to-Case routing settings if the queue has its own routing email address. Review the Public Group memberships that include the queue: Salesforce removes those sharing relationships without throwing an error.

Why you can't just delete Salesforce queue without a plan

I was recently helping a client clean up their Service Cloud setup, and they asked what actually happens when you delete Salesforce queue. It sounds like a simple admin task, but hit the button without prepping and you end up with a mess of orphaned records and broken processes.

When you delete a queue, Salesforce removes the Group record and the QueueSobject mapping. The records that were sitting in that queue don't magically move to a new owner. They stay assigned to the ID of a group that no longer exists. It is a lot like deleting roles in an org; you have to know where the dependencies are hiding before you pull the trigger.

What happens to your data?

Once the queue is gone, the OwnerId on those records points to a "ghost" ID. In the Salesforce UI, the owner field might look blank or show the old name as plain text that you can't click on. This is where things get risky for your team. If a Lead or Case is owned by a deleted queue, your list views and reports might stop showing them entirely. I have seen teams lose track of dozens of high-value leads just because they didn't reassign them first.

The records are only half of it. Any automation you've built, whether it is a Flow, a Workflow Rule, or an Assignment Rule, will likely break if it tries to route something to that deleted ID. If you are dealing with large data volumes, the cleanup matters even more, because you don't want to hit governor limits while fixing the mess later.

Technical steps to safely delete Salesforce queue

Before you delete Salesforce queue from your setup, you need to do some homework. Salesforce will sometimes block the deletion if the queue is referenced in certain places, like active assignment rules. But it won't catch everything. Here is the workflow I use to make sure nothing breaks.

  1. Find the records. Run a SOQL query to see exactly how many records are currently sitting in the queue.
  2. Reassign everything. Use the Data Loader or a quick Apex script to move those records to a new user or a different queue.
  3. Check your automation. Search your Flows and Assignment Rules. If you have hardcoded IDs (which we shouldn't do, but let's be real, it happens), you need to update them.
  4. Fix the email routing. If the queue has its own email address for Email-to-Case, you have to update those routing settings.

Pro tip: Always check your Case Assignment Rules first. It is the most common reason a deletion fails with a "standard" error message that doesn't tell you much.

Useful SOQL and Apex for the cleanup

If you want to be precise, open the Query Editor. First, find the ID of the queue you are targeting:

SELECT Id, Name FROM Group WHERE Type = 'Queue' AND Name = 'Support_Queue'

Once you have that ID, you can see which records are still hanging out there. For Cases, it would look like this:

SELECT Id, Subject, Status FROM Case WHERE OwnerId = '00Gxxxxxxxxxxxx'

If you have a few hundred records to move, a quick Apex snippet in the Anonymous Window is usually faster than a Data Loader export/import. Whether you prefer Apex vs Flow for your daily tasks, code is definitely the winner for quick one-off data fixes like this.

Id newOwnerId = '005xxxxxxxxxxxx'; 
List<Case> casesToUpdate = [SELECT Id FROM Case WHERE OwnerId = '00Gxxxxxxxxxxxx' LIMIT 200];
for (Case c : casesToUpdate) {
    c.OwnerId = newOwnerId;
}
update casesToUpdate;

Common blockers and errors

Salesforce is pretty good at protecting you from yourself, but it isn't perfect. It will usually stop you if the queue is used in a Lead or Case Assignment Rule. It might not stop you if the queue is referenced in a Flow or a formula field. That is where the "ghost" owner issues come from.

Look at your Public Group memberships too. If this queue is a member of another group, or if other groups are members of this queue, those relationships just vanish. It won't throw an error, but it might mess up your sharing logic if you aren't careful.

Key takeaways

  • Salesforce does not auto-reassign records when you delete a queue.
  • Always reassign records to a new owner before hitting the delete button.
  • Check Assignment Rules, Flows, and Email-to-Case routing for references.
  • Use SOQL to verify the queue is actually empty before you finish.
  • Orphaned records can "disappear" from standard list views if their owner is deleted.

Don't rush it. Deleting a queue is easy, and fixing the data debt it leaves behind is a headache. Take ten minutes to query your records and check your assignment rules, and you won't be hunting for "missing" cases three weeks from now. Reassign, update your routing, and then you can safely delete Salesforce queue.

Frequently asked questions

What happens to records when you delete a queue in Salesforce?

Salesforce does not reassign records when a queue is deleted, so their OwnerId still points at a deleted group ID. In the user interface, the owner field may appear blank or unclickable, and the records may stop appearing in standard list views and reports.

Why does Salesforce block deleting a queue?

Salesforce blocks queue deletion when the queue is referenced in an active configuration such as a Lead or Case Assignment Rule. You must remove or update those rule entries before Salesforce allows you to delete the queue.

How do you safely reassign records before deleting a Salesforce queue?

Query the Group object with SOQL to find the queue ID, then query the records assigned to that OwnerId. Reassign the records to an active user or another queue using Data Loader or an Apex script executed in the Developer Console.

Newsletter

One email every Tuesday

New guides, tool updates, and the release-note changes that break things.

No spam. Unsubscribe in one click.

Comments

Loading comments...

Leave a Comment