Model import and export in D365 Finance and Operations using Powershell

When we want to move customization done on specific model from one environment to other development environment we need to export and import the model file.

Steps for model import and export using PowerShell :-

  1. Open PowerShell in administrator mode.
  2. Change directory to the path of package bin folder.
  3. Export command:-.\ModelUtil.exe -export -metadatastorepath=C:\AOSService\PackagesLocalDirectory -modelname=”name of model” -outputpath=path to store model after exportFor example:

    If model name is TOUpgradeModel and I want to store the model file to path is C:\Temp\ModelFile

    The command will be as follows:

    .\ModelUtil.exe -export -metadatastorepath=K:\AosService\PackagesLocalDirectory -modelname=”TOUpgradeModel” -outputpath=C:\Temp\ModelFile
    Output file you can see on the specified path as

  4. Import Command :-.\ModelUtil.exe -import -metadatastorepath=C:\AOSService\PackagesLocalDirectory -file=the path from. axmodel to importFor example:

    .\ModelUtil.exe -import -metadatastorepath=C:\AOSService\PackagesLocalDirectory -file=C:\Temp\ModelFile\TOUpgradeModel-Cloudfront.axmodel

    ( Note : If model already exist in your environment, trying to import the same model you will     receive the error message of “Model already exist”. So, delete the existing model by command

    .\ModelUtil.exe -delete -metadatastorepath=C:\AOSService\PackagesLocalDirectory -modelname=” TOUpgradeModel ”

    try to import the model)

Share Story :