Skip to main content

Step by step import with Data Migration Framework [AX 2012]

Follow the steps on msdn to install the Data Migration Framework.

Once you have install, there is also a user guide on msdn but not very detailed. I did my first walk through today and took some notes along the way.

There are demo files you should look at.

C:\Program Files\Microsoft Dynamics AX 2012 Data Migration Framework (Beta)\DemoFiles\Delimited

1. Click on Data Migration Framework > Setup > Source data formats to set up your source data format. Currently there is on flat file imports available with possible future enhancements from Microsoft to support other types.


2. Under the Applications content, you can select your dimensions. The Dimension code lookup is a multiselection lookup (tick the selection box on the left of the lookup and ok).


3. Click on Data Migration Framework > Common > Processing group. Create a new record and give it a name and description


4. From the Processing group form, click on Entities.

Create a new record. In this example I created one for a Vendor import. The Sample file path field will be blank.


Note: You can use the demo file located under the installed folder. C:\Program Files\Microsoft Dynamics AX 2012 Data Migration Framework (Beta)\DemoFiles

If you use the Demo files, then skip steps 5 to 7. If you want to modify the columns, then do steps 5 to 7, as it will ask you if you want to modify the existing file format.

5. Generate a sample file by clicking on Generate source file button. Follow the wizard and select the fields to import.


6. Then click the Generate sample file button. This will open up the sample file in notepad.


Click Finish when done.

7. Now fill in your data on the txt file.


8. Back on the main form click the Generate source mapping button. This will analyse the file and do the mapping between the file and the stagging table.

9. Now you can open and view the mapping by clicking on the Modify source mapping button.

It should looks something like this. The Source is your txt file and the Staging is your staging table in AX. If your source file is messed up, you should be able to see it here.


10. Now validate the setup by clicking the Validate button on the main form.

11. View target mapping. This is a mapping between the Staging to the Target table. This should already be predefined. You can however modify the mapping.

Notice a the Function options on the left. These are predefined methods in the class to allow you to execute business logic. The example below, when you pass in a string of dimensions A-B-C, the GenerateDefaultDimension function splits the string up and generates a DefaultDimension RecId. A similar thing happens with the GenerateParty, which creates all the required global address book records to return a Party RecId.


12. Back on the main form.Click the Preview source file button. This loads up the file, to give you a preview of your file..


13. Go back to the Processing group form and click the Get staging data. This opens up a dialog with the processing group, click OK. You will then get this form.

Click on the Run to run client side or Click on Run on AOS to run server side. Usually, the user account doing the import wont have access to SQL integration servers. Use the second option and it will run under the service account. This should run and complete with out errors.


14. You can now see the staging table by going to the Execution history from the Processing group form. From there you click the View staging data button. You can modify the staging data before you process it to the target.


15. To process to the target, click on the Copy data to target button. Follow the options to execute the process.

You are now done. The result should be the vendor record created.


Popular posts from this blog

AX - How to use Map and MapEnumerator

Similar to Set class, Map class allows you to associate one value (the key) with another value. Both the key and value can be any valid X++ type, including objects. The types of the key and the value are specified in the declaration of the map. The way in which maps are implemented means that access to the values is very fast. Below is a sample code that sets and retrieves values from a map. static void checkItemNameAliasDuplicate(Args _args) { inventTable inventTable; Map map; MapEnumerator mapEnumerator; NameAlias nameAlias; int counter = 0; ; map = new Map(Types::String, Types::Integer); //store into map while select inventTable { nameAlias = inventTable.NameAlias; if (!map.exists(nameAlias)) { map.insert(nameAlias, 1); } else { map.insert(nameAlias, map.lookup(nameAlias) + 1); } } //retrieve fro

AX - How to use Set and SetEnumerator

The Set class is used for the storage and retrieval of data from a collection in which the values of the elements contained are unique and serve as the key values according to which the data is automatically ordered. You can create a set of primitive data types or complex data types such as a Class, Record or Container. Below is sample of a set of records. static void _Set(Args _args) {     CustTable       custTable;     Set             set = new Set(Types::Record);     SetEnumerator   setEnumerator;     ;     while select custTable     {         if (custTable && !         {             set.add(custTable);         }     }     if (!set.empty())     {         setEnumerator = set.getEnumerator();         setEnumerator.reset();         while (setEnumerator.moveNext())         {             custTable = setEnumerator.current();             info(strfmt("Customer: %1",custTable.AccountNum));         }     } } Common mistake when creating a set of recIds

Import document handling (attachment) files #MSDyn365FO

Out of the box you have limited data entities for migrating attachments. If you search what is already in the AOT, you will see a few various examples. I suggest you look at the LedgerJournalAttachmentsEntity as it is the simplest and cleans to copy from. I wont go into detail but I will give a quick run down of what it looks like. Use the DocuRefEntity as your main datasource. It does most of the work for you. Set your table you want to import for as the child datasource Add the Key You will need to add the postLoad method. There is minor code to update the virtual field FileContents. Below is an export I did for the general journal attachments. The import zip structure should be the same way. It will create the usual artifacts such as the excel, manifest and package header xml files. You will see a Resources folder under that. If you drill down to the resources you will see the attachments. This is an export and it used the document GUID for uniqueness. The other thing is the extensi