Tuesday, December 27, 2016

AX 2012 – How to move DMF Setup across Enviroments

Hi Guys

Often is necessary to move the DMF Setup, without include the DMF Staging tables, from one environment to another.

How to do it?

Out of the box there isn’t any standard feature that allow you to achieve this goal.
The steps are:

1-      Retrieve a list of the DMF Setup Tables
2-      Move to another environment without broken the relation by Recid

About the first step I have created a job in order to list the DMF Setup tables.
The trick is been exclude the tables that present the EXECUTIONID field, so the staging table!

static void DMFSetupTables(Args _args)
    utilIdElements  utilIdElements;
    DictTable       dictTable;
    SqlDictionary   SqlDictionary;
    Map             mapTable;

    mapTable = new Map(Types::Integer, Types::Integer);

    while select utilIdElements
    where utilIdElements.recordType == UtilElementType::Table
       && utilIdElements.name like "DMF*"
        dictTable = new DictTable(utilIdElements.id);
        if ( dictTable.isView()
        ||   dictTable.isTempDb()
        ||   dictTable.isTmp()
        ||   dictTable.isMap()
        ||   mapTable.exists(utilIdElements.id)
        Select recid from SqlDictionary where SqlDictionary.tabId == utilIdElements.id && SqlDictionary.name == "EXECUTIONID";
        If ( SqlDictionary )

        mapTable.insert(utilIdElements.id, utilIdElements.id);
        info ( queryValue(utilIdElements.id) + "-" + utilIdElements.name );

About the second step, I used the Test Data Transfer Tool in order to export and import the DMF Setup tables.

Therefore, I created a txt file like below with the Tables list coming from the above Job and move in the ‘[Lists]’ Folder of the TDTT Package and run the Tool.


That’s it!

Happy Christmas!

1 comment:

microsoft dynamic ax said...

thank you so much for sharing this information about how to move DMF Setup across Enviroments in Microsoft Dynamics AX, it's just what I've needed.

Happy Holidays!