web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Moving a model to another layer

(0) ShareShare
ReportReport
Posted on by

I have a solution that many customers have installed as a var layer model.  Since the initial version we have moved on to certify our solution.  Part of certification is to supply the code as an isv layer model.  Is there any recommended practice for upgrading customers who are on our var layer solution to our isv layer version?  I've seen a few possibilities but they don't seem like good options for customers.  The approach from this post works well for a development environment but it relies on a TFS installation and a developer license to the ISV layer which my customers won't have.  This one, I haven't tried yet but I don't think my customers will be excited to require a full database backup and restore.  The third option is to simply uninstall the previous models from the VAR layer and then install our ISV models.  Doing this will result in data loss and require reconfiguring the solution.  Is there a better option out there that I'm missing?  

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    I think the essence of what is going on both those posts you mention is lost. Obviously, the problem with moving layers is the IDs, which are now in 2012 installation-specific. If you refer to the msdn description of how these work, during model import AX will consider if the object with the same origin GUID already exists, if so it reuses that ID. That is what is key to preserving your data when moving layers.

    What Shashi does with the database backup is the solution with one environment. But essentially what you need is a model file that contains all the code you want to move, but the model needs to be for your "new" layer.

    Let's take an example if you wanting to move the code from USR to CUS layer. If you were able to import a model into CUS that would contain all the code, AX would recognize the objects that are already there, and essentially assign the same ID again. You then effectively have the same code in both layers. If you then remove the higher layer model, you're left with the lower layer model. You've moved the code without losing data (as the IDs have remained the same).

    Sashi's solution with the backup is essentially that... he just needs the code in the CUS layer to get that model. Then he puts the backup back so the modelstore is restored and the code is back in the USR layer. Then you plop the CUS model in there and remove the USR model, done.

    If you don't want to do a backup/restore, you'll just need a separate environment somewhere - to import the code into the destination layer and extract the model for it.

    I'm guessing one other way of doing it is exporting the model from the source layer, and "hacking" the model manifest that is embedded in the model to point to the new layer, then import that. Something I'll have to try some day :-)

  • Suggested answer
    Martin Dráb Profile Picture
    237,948 Most Valuable Professional on at

    Use any procedure you like to move your module to the ISV layer (I naturally used TFS because we used it for development). Export the model and install it to customer application without uninstalling the model in the VAR layer. The module should be overwritten in the same way as if you deliver other changes in a new version of the module, even if layers are not the same.

    Of course, test the procedure to be sure that it works as expected. I did a brief test in AX2012 R2.

  • Smalkmus Profile Picture
    60 on at

    Thanks, Joris and Martin for your replies.  If I'm understanding Joris' idea correctly, my initial idea was to do the same.  Simply install the models to the ISV layer while the other models were still in the VAR layer and then delete the VAR layer models.  I got errors that the model name is already in use with this approach.  I will try first rename the existing models, then install my ISV models, and then delete the VAR layer models.  

    Thanks again for the ideas.

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    I did test this on a RTM CU4 install here, it complained the model already existed in a higher layer. So i had to rename the model in the higher layer for AX to allow installing it in a lower layer. You can do a quick manifest update with axutil edit /model:XYZ /manifest:Publisher=Temp (or something like that)

  • Smalkmus Profile Picture
    60 on at

    Thanks again for your helpful reply.  I tried changing the initial model names in the VAR layer and then installing the models in the ISV layer.  When I try to install the model in the ISV layer, I get this error saying that one or more conflicting model elements already exists in an installed model.  I would expect to get this error if I don't use the conflict -push and install another model in the same layer but in this case, I'm installing in a lower layer so I can't see any reason for this error.  Do you have any idea why it would happen?  Here's the error message:

    Install-AXModel : The pipeline has been stopped.

    At line:1 char:16

    + install-axmodel <<<<  -file "C:\models\MyISVModel.axmodel"

       + CategoryInfo          : OperationStopped: (:) [Install-AXModel], PipelineStoppedException

       + FullyQualifiedErrorId : One or more conflicting model elements already exists in an

       installed model.,Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.PowerShell.InstallAXModelCommand

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    Conflicts should not occur across layers. Do you have any other models in the ISV layer? If you push objects you can see what they are.

  • Greg's Mom Profile Picture
    on at

    Thanks again, Joris.  It looks like it's a problem with our configuration keys.  Using -Conflict push, I get this error: 

    Install-AXModel : The pipeline has been stopped.

    At line:1 char:16

    + install-axmodel <<<<  -file "C:\models\MyISVModel.axmodel" -details -conflict push

    + CategoryInfo          : OperationStopped: (:) [Install-AXModel], PipelineStoppedException

    + FullyQualifiedErrorId : The model contains a customization of a configuration key. The model cannot be imported because you can overlayer a configuration key from the patching layer only.,Microsoft.Dynamics.AX.Framework. Tools.ModelManagement.PowerShell.InstallAXModelCommand.

    Is it possible to move specific elements out of a model from the command line?  I have been searching but haven't found any command yet.  My thinking is to move the configuration keys from the VAR layer models to a temporary model, uninstall that temporary model, and then install my ISV models.

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    No you can't manipulate a model outside of AX or during an import or export.

    I haven't looked in 2012, but in previous versions of AX config key status (on/off) within an environment was stored using its ID. So removing the model and re-importing would probably result in new IDs, which means you'll probably end up with the config key status being changed.

    Note the use of "probably" :-)

  • Greg's Mom Profile Picture
    on at

    So moving the model from the high layer to the lower layer without data loss seems doable using these steps: 

    1.  Delete the configuration keys from the model in the higher layer

    2.  Rename the model in the higher layer

    3.  Install the model in the lower layer

    4.  Uninstall the model in the higher layer

    This works but the problem is that our models are in the VAR layer.  As I can't expect my customers to have a VAR layer development license, I don't see any way for them to remove the configuration keys in step 1.  Is there anything I'm missing?  Is there any way to remove a configuration key without removing the entire model?  

  • Greg's Mom Profile Picture
    on at

    One option I'm considering but haven't tried yet is to create a VAR model that is exactly the same as my existing VAR model without the configuration keys.  If i install the VAR layer model without the configuration keys and replace the VAR model with the configuration keys, will that remove the configuration keys?  If so, I can then modify the steps above like this:

    1. Install model without configuration keys in the higher layer selecting option to replace existing model
    2. Rename the model in the higher layer
    3. Install the model in the lower layer
    4. Uninstall the model in the higher layer

    The question is whether installing an identical model with the exception of missing configuration keys will remove the configuration keys from the system.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans