page contents

Moving Customizations Between Layers in Dynamics AX 2012


Recently, one of our clients wanted to consolidate their customizations distributed between two different layers (CUS & USR) into one layer (CUS). Ideally, all customizations developed by customers should reside in the CUS layer to facilitate maintenance and easy upgrades. Hence, they decided to move the customizations in USR layer to the CUS layer, in effect collapsing the two layers into one.

Some of the customizations in the USR layer include custom tables and table fields. Maintaining the object IDs of these artifacts while moving them between layers is critical. If object IDs of these artifacts change in the process, data could be lost when data dictionary is synchronized. Since objects cannot be exported with object IDs in Dynamics AX 2012, using XPOs to move objects between layers will not work. Hence, we had to use a different approach to accomplish this task. Here are the steps we followed:

  1. Start with the original source environment and clean up any unnecessary artifacts in the USR layer.
  2. Create a separate, identical sandbox instance with the modelstore from the source environment.
  3. Delete the USR layer from the sandbox environment.
  4. From the source environment, export all the objects in USR layer into an xpo.
  5. In the sandbox environment, log into the CUS layer and import the xpo from the previous step.
    • Do a full compilation to ensure there are no errors in the CUS layer.
  6. Export the CUS layer models from sandbox environment into axmodel files and import them into the source environment, with the USR layer still in place. This will guarantee the following:
    • All the objects are imported into the CUS layer.
    • They retain their original object IDs, since they currently reside in the USR layer. (AX 2012 will reuse an object ID, if the object already exists in the system in a different layer).
  7. Once the models have been imported successfully into the CUS layer in the source environment, delete the USR layer.
  8. Do a full compilation and CIL generation.

MovingCodeUSR2CUS

 

This results in an environment with all the objects previously in the USR layer now moved to the CUS layer, with the original object IDs intact. For more information, you can read this Technet article about Maintaining Installation-Specific Element IDs and Element Handles

This is a fairly simple scenario. However, it can be easily extended and replicated for customizations that are distributed across multiple layers (VAR, CUS, USR and corresponding patch layers).

 

The Dynamics AX PFE team from Microsoft offers several services, including training in Application Lifecycle Management and Version Control using Team Foundation Services. For more information, please contact your Technical Account Manager.

-- Manny Chundi

Skip to main content