FK_ModelElementData_HasModelId_LayerId error

After applying the feature pack to an AX 2012 environment, during the full AOT compilation, I got the error as below:

Object Server 01:  The database reported (session 3 (Admin)): [Microsoft][SQL Server Native Client 10.0][SQL Server]The UPDATE statement conflicted with the
FOREIGN KEY constraint “FK_ModelElementData_HasModelId_LayerId”. The conflict occurred in database
“MicrosoftDynamicsAX”, table “dbo.Model”.. The SQL statement was: “{ CALL [dbo].[XU_Update](?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) }”

Actually the error is due to the fact that the syp layer of class HcmWorkerImport_DirPartyContactInfoView can’t be saved.

Microsoft released a hotfix to fix this issue, however, you need to redo the upgrade with a restored backup and than install the kernel hotfix and slipstream the hotfix in your AX 2012 Feature Pack installation files. Apparently this is not working for a production environment installation: sometimes we can’t afford to change the Modelstore in production environment.

After doing some investigation, I manage to manually fix these issues:

1. Use SQL Server Profiler to profile the compiling statement issued by AOS


2. Based on the query we got from step 1, find out which AOT element is causing the problem


3. Look up the correct element ID and handles in Meta database.



Now you can see the different Parent AXId of method “ExistLocationName”: ‘1023865’ and ‘1025020’

4. From AOT to open the system view “SysModelElement”.


5. The solution to this is to change the wrong parentID from ‘1025020’ to ‘1023865’ :

Run the following query on SQL Server to update the Table MODELELEMENT:


This entry was posted in 未分类. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s