Greetings all, I want to pass along some information about a scenario where some customers have recently been unable to install some of our hotfix packages for our Microsoft Dynamics AX 2012 R2 release. The scenario only occurs if all of the following conditions are met in the environment where the hotfix is being installed:
If all of those conditions are met, the symptom that partners and customers are seeing is the following error appearing either during the installation of the hotfix or by reviewing the log file after the hotfix fails (the number in the error message may vary):
AxUtil call returned errors:
Violation of PRIMARY KEY constraint 'PK_ModelElementData_ElementHandle'.Cannot insert duplicate key in object 'dbo.ModelElementData'. The duplicate key value is (832375, 1).
The statement has been terminated.
Error updating model database:Microsoft.Dynamics.Setup.AxSetupException: AxUtil call returned errors:Violation of PRIMARY KEY constraint 'PK_ModelElementData_ElementHandle'. Cannot insert duplicate key in object 'dbo.ModelElementData'. The duplicate key value is (832375, 1).
This error was introduced into our hotfixes as an unexpected side effect of merging the Data Import Export Framework code into the SYP layer with our Cumulative Update 7 release, which also moved the DMF labels into the SYP layer. The error we are experiencing is because we were trying to import these same DMF labels again into the SYP layer with the installation of the hotfix.
We have addressed the root cause of the issue so that hotfix packages built now will not contain the DMF labels within the hotfix, and have also released a way for customers and partners who have existing hotfixes that are in this "broken" state to proceed. If you have experienced this issue, you can follow these steps to allow you to install the hotfix package that is currently giving the primary key violation error.
7. Open the models folder, and you should see contents similar to this:
8. Locate the file that ends with the text syplabels.axmodel and either move it out of that folder or delete it from this models folder.
9. Now paste in the copy of the DynamicsAX2012R2-KB2923180-SYPLabels.axmodel file you took in step 5 above by pressing Ctrl-V in the Models folder or using right-click and choosing Paste. At this point your folder contents should look similar to this.
10. At this point you should be able to go back to the folder where you see the file axupdate.exe and run it just like you normally would to install a hotfix package. Our hotfix installer will then attempt to install this revised version of the SYPLabels.axmodel file and should proceed without the error.
The label file provided will work for any hotfix that was experiencing this error, because it is a cumulative collection of all labels up to the point in time when we fixed the hotfix process. The name of this new SYPLabels.axmodel file does not need to be changed within the models folder, as our hotfix installer will attempt to install each model file within that folder.
If you have issues with this process, or if your auditing requirements for hotfix installation require you to receive a new hotfix package to replace the original hotfix package being installed, please open a support incident and reference this blog article with either the issue you are experiencing or the need for a hotfix package to be recreated.