CrmDuplicateRecordException Error 0x80040237 “Cannot insert duplicate key.” during import of CRM Solution

So when you import a solution, then this leads to error 0x80040237 “Cannot insert duplicate key.”? Then download the solution import XML log file, open in Excel, and have a look at the name of the troubled entity.

Then unzip solution ZIP and open the customizations.xml. Find the troubled entity, the easiest is to search for:

<entity Name="[yourentity]">

Within this entity you should find something similar to this:





          <ControlDescriptionXML><controlDescriptions /></ControlDescriptionXML>




The PrimaryEntityTypeCode is from the origin/source environment. In the target environment, the PrimaryEntityTypeCode is different. This usually isn’t an issue, but somehow the system can get confused. Most likely you’ll find that the Guid for this CustomControlDefaultConfigId appears for two different PrimaryEntityTypeCodes in the target system. You can confirm this using this query:

SELECT PrimaryEntityTypeCode, * FROM CustomControlDefaultConfigBase WHERE CustomControlDefaultConfigId = '[your guid]'

If you indeed see records with different PrimaryEntityTypeCode and the same CustomControlDefaultConfigId, then this is indeed the issue. The one which doesn’t match the code from the XML file, in this example 10046, is the one from the origin environment, the other from the target environment. We should get rid of the one which matches the origin environment.

DELETE FROM CustomControlDefaultConfigBase WHERE CustomControlDefaultConfigId = '[your guid] AND PrimaryEntityTypeCode = '[PrimaryEntityTypeCode from customizations.xml]'

If after fixing this bug you’re faced with another error on the same entity, with the message ‘There should not be more than one component instance for a solution being upgraded’, then it’s getting more challenging. My advice? Contact Microsoft Support..


Kanhasoft said...

Are you looking for CRM Solution Developer? Kanhasoft offers custom CRM Software Development to the offshore clients from countries UK, Canada, USA, Japan, Australia, Sweden, Norway, Switzerland, New Zealand, Germany, South Africa and 45 more.

Karla said...

Lovely post. Learned so much from it. Many Many thanks. Cheers.

steve said...

الرائد تقدم خدمات تطهير و تعقيم خزانات المياه فى جدة و مكة لاننا :
افضل شركة غسيل خزانات بجدة
و افضل شركة غسيل خزانات بمكة
للمزيد قم بزيارة
افضل شركة تنظيف منازل

Packers and Movers Bangalore said...

Packers and Movers Bangalore as a Services providing company can make all the difference to your ###Home Relocation experience. Bangalore based Company which offers versatile solutions, Right team that easily reduce the stress associated with a ✔✔✔Household Shifting, ***Vehicle Transportation. we help things run smoothly and reduce breakages and offer you seamless, Affordable, Reliable Shifting Services, Compare Shifting Charges @
Packers And Movers Bangalore

Packers and Movers Chennai said...

Packers and Movers Chennai Give Safe and Reliable ***Household Shifting Services in Chennai with Reasonable ###Packers and Movers Price Quotation. We Provide Household Shifting, Office Relocation, ✔✔✔Local and Domestic Transportation Services, Affordable and Reliable Shifting Service Charges @
Packers And Movers Chennai

Brians Ocean said...

A befuddling web diary I visit this blog, it's incredibly grand. Strangely, in this present blog's substance made motivation behind fact and sensible. The substance of information is instructive
Thanks For Sharing
Types Of Obesity
Expensive Workout Equipment
Blood Pressure and Weight
Successful Journey Through Recovery
homemade laxatives
Deal With Stress
How Much Do You Really Owe Your Ex?
Can Mangosteen Cure Diabetes

Realtek Consulting said...

Thanks for sharing informative post.

Customer relationship management Software in chennai
CRM software in chennai
CRM software in us
erp in chennai
crm software development services in us
crm software development in us