Asked by:
Problem deleting custom entity from default solution

Question
-
I am using CRM Online hosted by Microsoft
I am trying to delete a custom entity from my default solution and the entity isn't included in any of our custom solutions.
This custom entity was part of a custom solution that has since been deleted. Now when trying to delete this entity from the default solution I see the following error in ErrorDetails log:<Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #B5C0852A</Message>
<ErrorCode>-2147220970</ErrorCode>
<Message>There should be at least one entity returned. Count: 0</Message>
- Edited by Jón Atli Friday, April 8, 2016 2:51 PM
Thursday, April 7, 2016 9:25 AM
All replies
-
Is CRM OnPremise ? If so, try enabling tracing to see if that gives any more useful information
Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk
Thursday, April 7, 2016 1:39 PMModerator -
We're seeing the same error trying to delete a custom entity from the default solution. Did you end up finding a solution?
Monday, April 11, 2016 9:50 PM -
Unfortunately we haven't yet found the solution to this problem.
If we do I will be sure to post it as the answer since it now seems I am not the only one having this problem :)Tuesday, April 12, 2016 8:22 AM -
An issue that I think is related: I can't import a solution that contains the entity in question. I get error: "Cannot insert duplicate key". :/ We'll probably open a support ticket, I'll post back if we do.Tuesday, April 12, 2016 11:10 AM
-
Hi,
I have the same error, also related to the "Cannot insert duplicate key". When I create a solution with just this entity inside, no forms, views, etc. just the entity and I try to import, I get the duplicate key error.
As a fix, I'm trying to delete the entity, but get this error on delete.
If there is any news about that problem, please post!
b.r.Martin Franz
P.S. Dynamics CRM 2016 Update 1 on Premises (upgrade to Update 1 didn't help)
Thursday, June 30, 2016 7:03 AM -
Okay, after long investigation (tracing SQL Server on solution import...the Dynamics LOG didn't supply any usefull information):
The problem seems to be related to ribbon customization - at least, one of the inserts with a "HideCustomAction" did fail. We already had this suspicion, as the problem did arise after we did ribbon customizations...
I will now investigate further in this, maybe I find a way to repair that.
Also, the problem may be related to the German Version of Dynamics CRM. Our Development Server, as well as test and production server are all German versions of CRM2016. When we export an solution and import that on a newly created (empty) organisation, we get no error. But when then create an solution with just this "bad custom entity" in it and try export and reimport, we get that duplicate error. But - very very strange - if we do the exactly same steps on the English version of CRM, we NEVER get this error. Even more: if we export the Default solution from the English version and import that on a new org on the German version, we also don't get this error anymore. Also, deleting that custom entity suddenly works. In other words: the english server did repair that problem. Unfortunatelly, importing this "english" default solution in one of the existing orgs does not work.
b.r.Martin
Thursday, June 30, 2016 11:43 AM -
Okay, after long investigation (tracing SQL Server on solution import...the Dynamics LOG didn't supply any usefull information):
The problem seems to be related to ribbon customization - at least, one of the inserts with a "HideCustomAction" did fail. We already had this suspicion, as the problem did arise after we did ribbon customizations...
I will now investigate further in this, maybe I find a way to repair that.
Also, the problem may be related to the German Version of Dynamics CRM. Our Development Server, as well as test and production server are all German versions of CRM2016. When we export an solution and import that on a newly created (empty) organisation, we get no error. But when then create an solution with just this "bad custom entity" in it and try export and reimport, we get that duplicate error. But - very very strange - if we do the exactly same steps on the English version of CRM, we NEVER get this error. Even more: if we export the Default solution from the English version and import that on a new org on the German version, we also don't get this error anymore. Also, deleting that custom entity suddenly works. In other words: the english server did repair that problem. Unfortunatelly, importing this "english" default solution in one of the existing orgs does not work.
b.r.Martin
Hello Martin,
Have you found solution to repair your issue about your last customization on ribbon?
It seems we got quite the same issue, as we've just made customization on 4 entities (call Js on custom buttons), and it seems to work well for all entities except for one of them, with message error "Cannot insert duplicate key." and no more precision about the Element type...)
At least, where did you find more details on Solution XML that could help me as well?
Thank you for your help
Tuesday, August 2, 2016 3:22 PM -
I had the exact same issue and it turned out there was a duplicate GUID within the CustomControlDefaultConfigBase table. The following query highlighted this:
SELECT COUNT(*), CustomControlDefaultConfigId
FROM dbo.CustomControlDefaultConfigBase
GROUP BY CustomControlDefaultConfigId
HAVING COUNT(*) > 1SELECT PrimaryEntityTypeCode
FROM dbo.CustomControlDefaultConfigBase
WHERE CustomControlDefaultConfigId = 'idfromabove'If the second query returns 2 different Entity Type Codes you will need to perform an update on one of them and give it a unique id.
After looking at verbose trace logs and SQL trace logs a query was being executed on the view CustomControlDefaultConfigLogicalAsIfPublished and expecting a result for one of the duplicate GUIDs but as a result of how the view is written if there are 2 entities with the same ID it will always return zero results.
Its a nasty hack, probably a bug in this system, but it should get you moving again.
Tuesday, June 20, 2017 8:34 AM