Dynamics AX 2012 Excel Add-in – Data Import
Purpose: The purpose of this document is to illustrate how to use Dynamics AX 2012 Excel Add-in for import of data.
Challenge: Data model changes in Dynamics AX related to high normalization and introduction of surrogate keys made import of data more complex. Additionally there are number of differences between Excel and AX Rich Client from UI standpoint when it comes to defaulting logic, use of number sequences, segmented controls and complex UI logic. AX Rich Client is obviously more dynamic comparing to Excel. However a lot of post-processing is usually done behind the scenes by means of AIF Proxy classes when the information is published into Dynamics AX.
Solution: Dynamics AX 2012 ships with the number of AIF Web Service which can be used in integration scenarios. However not all of them can be used in Excel at the moment for import of data. In order to import data using Excel the appropriate tables can be used instead.
Data Model:
Table Name | Table Description |
AlexParent | Sample table |
AlexTable | Sample header table which extends from sample table |
AlexLine | Sample lines table |
Data Model Diagram:
Sample Data Model
Walkthrough:
Connection
Add Tables
Dynamics AX Error
Solution
<!--[if !supportLists]-->-<!--[endif]-->Add replacement key to AlexParent table
<!--[if !supportLists]-->-<!--[endif]-->Add replacement key to AlexTable table
<!--[if !supportLists]-->-<!--[endif]-->Add replacement key to AlexLine table
Project
AlexParent table
AlexTable table
AlexLine table
Once Replacement key is added on AlexTable table Excel Add-in will be able to interpret Surrogate key relation between AlexTable table and AlexLine table using Natural key (Replacement key).
Table/Field Properties
Query
Generate AIF Proxy classes
Select Document Parameters
Select Code Generation Parameters
Completed
Project AxdAlex
Generate Incremental CIL
Field Chooser
Excel Add-in takes into account table inheritance
Also please note that ID field in AlexTable table (and ParentID field in AlexParent table) is used for Replacement Key <-> Surrogate Key translation
AlexTable
Field Name | Field Description |
InstanceRelationType | |
ParentID | |
ID | |
A | |
B | |
C | |
D |
AlexLine
Field Name | Field Description |
AlexTable.ParentID | |
AlexTable.ID | |
E | |
F |
Sequence:
<!--[if !supportLists]-->1.<!--[endif]-->AlexTable – Publish Selected
<!--[if !supportLists]-->2.<!--[endif]-->AlexLine – Publish Selected
Result:
Dynamics AX – Table Browser
AlexParent
AlexTable
AlexLine
SQL Trace:
Summary: For the purposes of small or medium data migration (data conversion) where performance is not a concern Excel can be used for import of data into Dynamics AX 2012. Although some of AIF Web Services can’t be used at the moment in Excel for import of data, appropriate tables can be used instead. Excel template can be created and used for import of data.
Author: Alex Anikiev, PhD, MCP
Tags: Dynamics ERP,Dynamics AX 2012, Excel, Dynamics AX 2012 Excel Add-in, Data Import, Data Conversion, Data Migration, Application Integration Framework, Table Inheritance, Surrogate Key, Natural Key, Replacement Key.
Note: This document is intended for information purposes only, presented as it is with no warranties from the author. This document may be updated with more content to better outline the concepts and describe the examples. It’s recommended that all Data Model changes introduced as a part of this demonstration will be removed once you complete data import exercise.