Microsoft Edge Try Microsoft Edge A fast and secure browser that's designed for Windows 10 Get started

This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to this use. Learn more
Microsoft
Dynamics 365 Community
  • Microsoft 365
  • Azure
  • Office 365
  • Dynamics 365
  • SQL
  • Windows 10
      • Windows Server
      • Enterprise Mobility + Security
      • Power BI
      • Teams
      • Visual Studio
      • Surface for Business
      • AI
      • Internet of Things
      • Azure Cognitive Services
      • Quantum
      • Research
      • Docs
      • TechNet
      • Developer Network
      • Windows Dev Center
      • Windows IT Pro Center
      • FastTrack
      • Partner Network
      • Solution Providers
      • Partner Center
      • Cloud Hosting
      • Education
      • Financial services
      • Government
      • Health
      • Manufacturing & resources
      • Retail
      • Security
      • Licensing
      • AppSource
      • Azure Marketplace
      • Events
    • View all
    Sign in
    • Home
      • Sales
      • Customer Service
      • Field Service
      • Talent
      • Finance and Operations
      • Retail
      • Project Service Automation
      • Marketing
      • Business Central
      • General
      • Microsoft Dynamics CRM
      • Microsoft Dynamics AX
      • Microsoft Dynamics NAV
      • Microsoft Dynamics GP
      • Microsoft Dynamics SL
      • Other Products
    AX Forum Ideas
    • Learning Resources
    • Documentation
    • AX Blogs
    • Community News
    • Get Started
    • Introduce Yourself
      • Earn Badges
      • View Badges
      • Compete on Leaderboards
      • View Leaderboards
    • Become an Expert
    • Request a New Blog
    • Provide Feedback
    User Groups

    • Sign In/Sign Up
    • Home
    • Forum
    • Blogs
    • Videos
    • Experts
    • Support
    • Communities
      • Microsoft Dynamics AX
      • Microsoft Dynamics CRM
      • Microsoft Dynamics GP
      • Microsoft Dynamics NAV
      • Microsoft Dynamics SL
      • Other Products
      • Partner Community
      • Envision

    Violation of PRIMARY KEY constraint 'PK_ModelElementData_ElementHandle' error installing some hotfixes on Microsoft Dynamics AX 2012 R2

    • Sign In
    • Home
    • Share
      • Twitter
      • LinkedIn
      • Facebook
      • Email
      • Print
    • RSS
    8 Jan 2014 10:03 AM

    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:

    1. The environment is running on application code of Microsoft Dynamics AX 2012 R2 on a release before CU-7
    2. The environment has installed a version of the Data Import Export Framework so that they have a DMF model within the FPK layer.
    3. The hotfix being installed was released AFTER Dynamics AX 2012 R2 CU-7 and before January 2nd, 2014.

    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).

    The statement has been terminated.

    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.

    1. Microsoft has released a special hotfix package that contains only a SYPLabels model file which we will use as a replacement file for your hotfix causing the error.
    2. Go to the following Label File Hotfix link and request a download of the hotfix by filling out the required information.
    3. Submitting the information on the form will generate an automatic email to the email address that was provided on the form which will include another link that is used to download the hotfix itself.
    4. After downloading this special hotfix which should have the name 471807_intl_i386_zip.exe, you can double-click on the executable to extract the contents. This will extract two files - hotfix.txt and DynamicsAX2012R2-KB2923180-SYPLabels.axmodel.
    5. Right-click on the DynamicsAX2012R2-KB2923180-SYPLabels.axmodel file and choose Copy, or select the file in the Windows Explorer and press Ctrl-C to get a copy.
    6. Locate the folder where you extracted the previous hotfix that was causing the error. In the previous hotfix folder, you should see a series of folders that looks similar to the following:

     

    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.

     

     

     

    Read Complete Post and Comments

    Meet the Author

    Dynamics AX Support picture
    Dynamics AX Support

    About AX Support

    This blog contains posts from the Microsoft Dynamics AX support team highlighting interesting features or issues within Microsoft Dynamics AX.

    Microsoft Dynamics AX

    Get help on your Microsoft Dynamics AX solution from qualified experts in the forums, read blogs and how-to articles, and watch videos.
    RSS

    Troubleshooting Guide

    • Microsoft Dynamics AX 2012
      • RapidStart Services
      • Data Import, Export and Migration
      • CRM Connector
      • Financials Management
      • Updating to Microsoft Dynamics AX 2012
    • Microsoft Dynamics AX 2009
      • Application Object Server (AOS)
      • Enterprise Portal and Role Centers
      • Inventory Costing
      • Invoice Settlements, Discounts and Reversals
      • SSRS and SSAS Integration
      • Workflow

    Recommended Content

    Violation of PRIMARY KEY constraint ‘PK_ModelElementData_ElementHandle’ error installing GSTUpdate hotfixes on Microsoft Dynamics AX2012 R2
    by Chandru on 17 Mar 2018
    • Suggested Answer
    Violation of PRIMARY KEY constraint ‘PK_ModelElementData_ElementHandle’ with AX 2012R2 CU8
    by Dick Wenning on 14 Apr 2015
    • 0 comments
    Violation of primary key constraint error when installing a hotfix
    by K3 BlogAX on 20 Jan 2014
    • 0 comments
    Violation of PRIMARY KEY constraint 'PKSY60100'
    by Mariano Gomez on 6 Jul 2011
    • 0 comments
    Violation of Primary Key Constraint on dbo.PA01304
    by Jon on 20 Jan 2015
    • Not Answered
    View More

    Top Tags

    "AX 2012" 2012 AX AX 2009 AX 2012 AX 2012 R2 AX 2012 R3 AX 2012 Upgrade ax for retail AX2009 ax2012 AX2012 R3 AX2012FP Content customization Dynamics AX dynamics AX 2009 Dynamics AX 2012 Enterprise Portal Financials Management - GL/AR/AP/Bank/Fixed Assets/Budgeting Microsoft Dynamics AX Performance pos retail Uncategorized

    What's new

    • Surface Book 2
    • Surface Pro
    • Xbox One X
    • Xbox One S
    • VR & mixed reality
    • Windows 10 apps
    • Office apps

    Store & Support

    • Account profile
    • Download Center
    • Sales & support
    • Returns
    • Order tracking
    • Store locations
    • Support
    • Buy online, pick up in store

    Education

    • Microsoft in education
    • Office for students
    • Office 365 for schools
    • Deals for students & parents
    • Microsoft Azure in education

    Enterprise

    • Microsoft Azure
    • Enterprise
    • Data platform
    • Find a solutions provider
    • Microsoft partner resources
    • Microsoft AppSource
    • Manufacturing & resources
    • Financial services

    Developer

    • Microsoft Visual Studio
    • Windows Dev Center
    • Developer Network
    • TechNet
    • Microsoft Virtual Academy
    • Microsoft developer program
    • Channel 9
    • Office Dev Center

    Company

    • Careers
    • About Microsoft
    • Company news
    • Privacy at Microsoft
    • Investors
    • Diversity and inclusion
    • Accessibility
    • Security
    English (United States)
    • Contact Us
    • Privacy & Cookies
    • Terms of Use
    • Trademarks
    • © Microsoft 2018