Category Archives: Model store

How to resolve the error while importing model store “The delete statement conflicted with the reference constraint “FK_ManifestHistoryHasCategoryId”. The conflict occured in databaes “db_name_model”, table “dbo.ModelOperationHistory”, column ‘categoryId’. The statement has been terminated..Microsoft.Dynamics.AX.Framework.Toolds.ModelManagement.PowerShell.ImportStoreCommand” in AX 2012.

Yesterday, I struggled a lot while importing model store which has thrown below error and stopped abruptly.

“The delete statement conflicted with the reference constraint “FK_ManifestHistoryHasCategoryId”. The conflict occured in databaes “db_name_model”, table “dbo.ModelOperationHistory”, column ‘categoryId’.
The statement has been terminated..Microsoft.Dynamics.AX.Framework.Toolds.ModelManagement.PowerShell.ImportStoreCommand”

untitled

when I started my R&D, I found different resolutions but best and less time consuming which I found is  I am going to share now. I tried this and works magically.

Here you go and just follow these steps.

1.  Create a temporary schema in the model store database.

2.  Import the model store file into the temporary schema.

3.  Apply the temporary schema.

Please have a glance on scripts which I executed in Management shell.

a) Create a temporary schema in the model store database and importing the file into it.

This example imports a model store to the Microsoft Dynamics AX database and associates it with a non-default schema (TemporarySchema). The new model store is not visible to Microsoft Dynamics AX until the imported model store has been applied to the default schema (dbo) by running Import-AXModelStore with the -Apply parameter. If you have AX instances more than 1, you need to supply -config parameter in script otherwise not needed. If you have conflicts then go with -IDConflict parameter either with overwrite or push, -Verbose parameter will show you objects conflicting in importing environment.

Import-AXModelStore -File “Path\filename.axmodelstore” -config: configname -schemaname TemporarySchema -Verbose -IDConflict Overwrite

b) Apply the temporary schema.

Import-AXModelStore -apply:TemporarySchema -config: configname.

Hope this helps you.

Till then Happy Daxing..

Axutil Commands

Dynamics 365

* AOS name in Server Configuration

Models List:

axutil list /config: <AOS name>

Model elements :

axutil view /model:<model id> /config:<AOS name>


Create a model:

axutil create /model:<model name> /layer:<layer name> /config:<AOS name>

Delete the existing model :

axutil delete /model:<model id> /config:<AOS name>

 export the modelstore:

axutil exportstore /file:”specify the location” /config:<AOS name>

Import a modelstore:

axutil importstore /file:”specify the location” /config:<AOS name>

 Edit a model properties:

Axutil edit /model:”model id” /manifest:Version=”<to which version>”,Publisher=”<publisher name>”,Description=”<Description>”

export the model:

axutil export /model:<model id> /file:”specify the location” /config:<AOS name>

 Import a model:
A model can be imported using several options which can be defined in the Axutil Command
Simple import of a model:
axutil import /file:”specify the location” /config:<AOS name>
Import with Conflict overwrite option:
axutil import /file:”specify the location” /config:<AOS name> /conflict:overwrite
Import with Conflict push option ( only for developers and technical consultants):
axutil import /file:”specify the location” /config:<AOS name> /conflict:push
Import with conflict overwrite and also use replace keyword:
axutil…

View original post 7 more words