ISSUE DESCRIPTION
=============
On Model driven app + Copilot service admin center, when trying to disable/delete a queue, an error occurs.
Error message:
Business Process Error
As there are active queue items associated with
this queue, this operation cannot be completed.
Please deactivate or delete active queue items
before trying to deactivate the queue.
But when we go inside the queue to deactivate 12 queue items, we cannot see any queue item inside.
This block customer to disable/delete a queue.
HOW TO FIX
=========
As these records are “orphaned” legacy queue items and these records are technically still active in the database but are invisible to Omnichannel agents, which prevents the queue from being disabled or deleted.
To resolve this, the queue items need to be updated from Active to Inactive. Please follow the steps below:
Step 1: Get the Queue ID
Open the affected queue and copy the Queue ID from the browser URL.
Step 2: Retrieve the Queue Item IDs via API
Replace <Queue ID> with the actual value:
==================================================
XXX.dynamics.com/api/data/v9.2/queueitems?$select=queueitemid&$filter=_queueid_value eq <Queue ID> and statuscode eq 1
==================================================
Step 3: Run the script to deactivate the queue items
Replace the queueItemIds with the IDs returned from the API.
Press F12, go to console tab to run as below.
==================================================
const queueItemIds = [
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
];
Promise.all(
queueItemIds.map(id =>
Xrm.WebApi.updateRecord("queueitem", id, {
statecode: 1, // Inactive
statuscode: 2 // Removed
})
.then(() => console.log("✅ Deactivated:", id))
.catch(e => console.error("❌ Failed:", id, e.message || e))
)
).then(() => console.log("🎉 All queue items processed"));
==================================================
Once these orphaned items are deactivated, the queue should no longer be blocked and can be managed as expected.