Thursday, 23 August 2012

Step by step import with Data Migration Framework - AX 2012


Continuation to my previous article AX 2012 Data Migration Framework

In this article, we are Importing the LedgerGeneraljournal into AX 2012. 

Demo Files are available at:
C:\Program Files\Microsoft Dynamics AX 2012 Data Migration Framework (Beta)\DemoFiles









This is the beta release and therefore there will be bugs, issues and it’s not a complete offering. With that, when we start to look at the use of this framework, we must start with the types of sources we can work from. We do this from the Data Migration Framework > Setup > Source Data Formats. 

Apart from flat file, MS is planning to add Ax and ODBC types to the framework.





We can see that there are plans then for allowing both ODBC source types, as well as enabling AX-to-AX, source-to-target usage of this framework. Since this is file based on source types for the Data Migration Framework, out-of-the-box usage for the framework is limited. It’s powerful, and has a lot of great possible value, specifically when the AX and ODBC types are fully added. DMF is work well with the file sources, as I have tested and imported some of the data. If your source data is in flat files then you can start getting a lot of use from the framework.

1. Click on Data Migration Framework > Setup > Source data formats to set up your source data format.





2. Applications:  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 for the LedgerGeneraljournal. If we are selecting data from demo flat files, select the path in The Sample file path field or else you want to select (modify) the fields then leave The Sample file path field will be blank.




If you use the Demo files, then skip steps 5, 6 and 7. If you want to modify the columns, then do steps 5, 6 and 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.


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.



12. When we check the Entities from, Click the Preview source file button. This loads up the file, to give you a preview of your file.




13. In 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. Now you can 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.





It’s done, Now the data has been migrated to AX 2012.

That's it for now... :) 



8 comments:

  1. Hi, Thanks for the walktrough!
    I have a question, does run business logic insert or update and run validate Write business logic work? It don't seem to execute the code for me.

    Thanks in advance!

    ReplyDelete
  2. If record does not exit, it will insert otherwise record will be updated.



    Mansoor Adeel

    ReplyDelete
  3. Thanks for your answer. Do you also know how dmf decides if a record needs to be updated or inserted? How does the framework decide the ids for this check?

    Thanks!

    ReplyDelete
  4. I am facing one problem, that is when i click get Staging Data button, i have got three records in my staging database and when i actually click on Copy Data To target button, only one record is inserted into the original table. The infolog shows Data written to target(1 record created, 2 records updated). why its behaving like that. it will not copy all the records in the table.It will update the first record with the last one only having only one record in the table finally.
    hope you will solve my problem.

    ReplyDelete
  5. Hopefully this helps someone else, Muhammad's problem would be due to the relationship between the staging DMF table and target table being wrong. It was most likely missing a relation field.
    The DMF uses that relationship to decide if its going to update or insert the record.

    ReplyDelete
  6. Hey Guys,
    When I try to import a new single product in AX through "Items" entity, it is supposed to give an infolog that it has created 1 record, instead it shows up an infolog with message "Data written to target 'Items' ('0' records created, '1' records updated)", however whne I check data it seems to be imported correctly into target. But the message is misguiding here. Can anybody please help me understanding this issue. Any solution will be greatly appreciated!!

    ReplyDelete
  7. The best data migration services companies like your company have helped me in performing various challenging data migration projects efficiently. The business and technical stakeholders involved by your company helped me in establishing the definite data migration objectives.

    ReplyDelete