CRM Default Team and Business Unit Delete Error Caused by WIP Bin queue


Recently on one of my Microsoft Dynamics CRM projects – we want to clean-up the various Teams/Business Units created over the years that are no longer relevant.  However – some Teams such as the default Teams are more challenging to delete due to the following reason – The default business unit team cannot be deleted.

image

Team Delete Error.  The default business unit team cannot be deleted. The name and membership for default team are inherited from their parent business unit.  The only way to remove a default team is to remove the team’s parent business unit.

Deleting a Microsoft Dynamics CRM Business Unit in CRM 2011 and later is pretty straight forward per this earlier blog post.

On this particular Microsoft CRM environment – it proved to be more challenging.

We’ve received the following error when trying to delete some Business Units after following the earlier blog post steps:

image

SQL Server Error.  The download log is pretty generic so it was not much help.  Since this is a CRM On-Premise – I could enable Microsoft Dynamics 365 tracing.  Enable Tracing on the CRM Server yield the following finding:

>Crm Exception: Message: Generic SQL error., ErrorCode: -2147204784, InnerException: Microsoft.Crm.CrmException: Generic SQL error. —> Microsoft.Crm.CrmException: Generic SQL error. —> System.Data.SqlClient.SqlException: The DELETE statement conflicted with the REFERENCE constraint “business_unit_queues”. The conflict occurred in database “CRM_MSCRM”, table “dbo.QueueBase”, column ‘BusinessUnitId’.
The statement has been terminated.

This detailed error log points to CRM Queue causing the issue when trying to remove the Business Unit.  One of the Queue’s field “BusinessUnitId” is referencing the Business Unit that we are trying to remove and not allowing it due to the SQL Reference constraint setup.  To further pin-point this – we used the following SQL to narrow down the exact Queues:

SELECT * FROM MSCRM.dbo.QueueBase WHERE BusinessUnitId = ’84EGAE8A-2691-E311-819C-00155D0AB80D’

The Queues turned out to be “WIP Bin queues” which were from CRM 4.0 and earlier version designs and are NO longer relevant in CRM 2011 or later per this article.  This makes sense since this Microsoft CRM environment was an upgrade from CRM 4.0 previously.

We will need to first remove these associated WIP Bin queues first and then delete the Business Units (and their default Teams).

What we did was setup a new Queue to store any Queue Items from the WIP Bin queues.  I usually called this Queue “WIP Bin queue items” and then use the Queue Item’s Route function to route any existing WIP Bin queues’ items to our new Queue.

A quick way to perform this is via Advanced Find on the Queue Items:

image image

 

After removing the associated WIP Bin queues items and then deleting the WIP Bin queues – we were able to successfully delete the Business Units which automatically delete the corresponding default Teams.  Yay!

 

 

Contact me if you need some Microsoft Dynamics 365 CRM Customer Engagement assistance.

Frank Lee, Microsoft Business Solutions MVP Dynamics 365 CRM
San Francisco Bay Area Silicon Valley Napa
Workopia, Inc – Keeping up with the Cloud Innovations!

Advertisements

About Microsoft Dynamics CRM Online

Microsoft Dynamics CRM and CRM Online specialist. Microsoft CRM MVP since 2006
This entry was posted in Advanced Find, CRM On Premise, Dynamics 365, Microsoft CRM, Microsoft Dynamics CRM, MS CRM, MS CRM 4.0, Troubleshooting and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s