[CRM 2016] Error code #0x80040237. Error while solution import. Cannot insert duplicate key.

We were deploying from sandbox to production with one of the solutions. And for no reason, the solution import failed on all attempts with error code #0x80040237. And there was not much description given except – “Cannot insert duplicate key”. This was the error on one of the entities.

First, we followed a post by a friend on the same error. We even removed some data to check if that is the case. But, the import failed again with the same error code and description.

Then, we came across similar question on MSDN. Question was already showing an answer that by removing <CustomControlDefaultConfigs> section from Solution.xml this can be resolved. This issue is already taken care on Dynamics 365. However, CRM 2016 Online, this issue still persists.

Resolution:

  • Extract your solution zip file.
  • Open solution.xml file in a text editor.
  • Search for the <entity></entity> tag for the entity on which your solution import is showing the error.
  • Find and remove <CustomControlDefaultConfigs> section inside the <entity> section.
  • Save the solution.xml file and create new zip file from the extracted solution contents.
  • Import will be successful this time!!

The reason to remove <CustomControlDefaultConfigs> section from solution.xml file is still not known. And there are other option also available like updating sql to resolve this error for on premise deployments. However, CRM Online users do not have any option but to modify solution.xml file.

Hope this helps!

Advertisements