Field name | Method name |
JournalNum | defaultJournalNum |
Name | defaultName |
NumberSequenceId | defaultNumberSequenceId |
JournalType | defaultJournalType |
PaymentGenerated_IT | defaultPaymentGenerated_IT |
OffsetAccount | defaultOffsetAccount |
PostedDateTime | defaultPostedDateTime |
OffsetAccountType | defaultOffsetAccountType |
GroupBlockId | defaultGroupBlockId |
Dimension | defaultDimension |
CurrencyCode | defaultCurrencyCode |
FixedExchRate | defaultFixedExchRate |
DetailSummaryPosting | defaultDetailSummaryPosting |
DocumentNum | defaultDocumentNum |
ExchRateSecondary | defaultExchRateSecondary |
ExchRate | defaultExchRate |
FixedOffsetAccount | defaultFixedOffsetAccount |
RemoveLineAfterPosting | defaultRemoveLineAfterPosting |
CurrentOperationsTax | defaultCurrentOperationsTax |
LedgerJournalInclTax | defaultLedgerJournalInclTax |
BankRemittanceType | defaultBankRemittanceType |
CustVendNegInstProtestProcess | defaultCustVendNegInstProtestProcess |
VoucherAllocatedAtPosting | defaultVoucherAllocatedAtPosting |
LinesLimitBeforeDistribution | defaultLinesLimitBeforeDistribution |
WorkflowApprovalStatus | defaultWorkflowApprovalStatus |
Microsoft Dynamics AX 2012 Excel Add-in – Questions and Answers (Defaulting Logic)
Microsoft Dynamics AX 2012 Excel Add-in – Questions and Answers (Depending Fields)
Microsoft Dynamics AX 2012 Excel Add-in – Questions and Answers (Related Records)
Microsoft Dynamics AX 2012 Excel Add-in – Questions and Answers (Validation Logic)
Microsoft Dynamics AX 2012 Excel Add-in – Questions and Answers (Business Logic)
LedgerJournalPost::postJournal(LedgerJournalTable, false); |
Dynamics AX 2012 Excel Add-in - Issues and Solutions (Method UpdateRecIdVisibility not found)
Microsoft Dynamics AX 2012 Excel Add-in – Security Roles (Add Tables, Add Data)
Recommendation | Description |
Always assign the least permissions when you set up and configure the user security features in Microsoft Dynamics AX. | Before you set up and configure the least permissions in Microsoft Dynamics AX, consider the following recommendations:
|
[SysEntryPointAttribute] public AifUserSessionInfo getUserSessionInfo() { AifUserSessionInfo info = new AifUserSessionInfo(); info.parmAXLanguage(this.getLanguage()); info.parmCurrencyInfo(this.getAifCurrencyInfo()); info.parmCompany(this.getCompany()); info.parmCompanyTimeZone(this.getCompanyTimeZone()); info.parmUserPreferredTimeZone(this.getUserPreferredTimeZone()); info.parmUserPreferredCalendar(this.getUserPreferredCalendar()); info.parmUserId(this.getUserId()); info.parmIsSysAdmin(Global::isSystemAdministrator()); info.parmAOSLocaleName(AifUserSessionService::getAosLocaleName()); return info; } |
Dynamics AX 2012 Inventory transactions/on-hand Import using Excel Add-in
Purpose: The purpose of this document is to illustrate how to use Microsoft Dynamics AX 2012 Excel Add-in for import of inventory transactions (on-hand).
Challenge: Data model changes in Microsoft Dynamics related to high normalization and introduction of surrogate keys made some imports more complex. In fact the data model forming Inventory Journal was not dramatically changed and import principle remains the same – populate the journal and then post the journal. However surrogate key link was introduced to some tables related to Inventory Journal transactions table.
Solution: Microsoft Dynamics AX 2012 ships with lnventory Journal AIF Web Service (InventProfitLossJournalService) which can be used in integration scenarios. However Inventory Journal AIF Web Service can’t be used in Excel at the moment for import of inventory transactions. In order to import inventory transactions using Excel the appropriate tables will be used.
Assumption: The assumption is that appropriate reference data such as released products (items), etc. was created in advance.
Data Model:
Table Name | Table Description |
InventJournalTable | The InventJournalTable table contains information about inventory journals. The table holds information about how the journal is handled by the system. |
InventJournalTrans | The InventJournalTrans table contains information about items and represents a line in an inventory journal. Each record has information related to a specific item and is related to a record in the InventJournalTable table, which is the journal header. |
Data Model Diagram:

Walkthrough:
Connection
Add Data
Dynamics AX – Error
Add Tables
Field Chooser
InventJournalTable
Field Name | Field Description |
Journal | |
Name | |
Description |

InventJournalTrans
Field Name | Field Description |
Date | |
Item number | |
Journal | |
Line number | |
Dimension No | |
Quantity | |
Cost price | |
Cost amount |
InventDim
Excel VLookup function may be used to find appropriate InventDimId automatically based on criteria
Sequence:
1.InventJournalTable – Publish Selected
2.InventJournalTrans – Publish Selected
Result:
Dynamics AX – Inventory Journal
Dynamics AX – Inventory Journal lines
Dynamics AX – On-hand

Dynamics AX – Posting
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 inventory transactions into Microsoft Dynamics AX 2012. Although Inventory Journal AIF Web Service (InventProfitLossJournalService) can’t be used at the moment in Excel for import of inventory transactions, appropriate tables can be used instead. Excel template can be created and used for import of inventory transactions.
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, Inventory on-hand.
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.
Dynamics AX 2012 Sales orders Import using Excel Add-in
Purpose: The purpose of this document is to illustrate how to use Microsoft Dynamics AX 2012 Excel Add-in for import of sales orders.
Challenge: Data model changes in Microsoft Dynamics related to high normalization and introduction of surrogate keys made some imports more complex. In fact the data model forming Sales Orders was not dramatically changed and import principle remains the same – populate the header and related lines. However some information which is usually automatically generated in Microsoft Dynamics AX 2012 Rich Client by means of number sequences such as sales order ID will have to be provided.
Solution: Microsoft Dynamics AX 2012 ships with Sales Orders AIF Web Service (SalesSalesOrderService) which can be used in integration scenarios. However Sales Order AIF Web Service can’t be used in Excel at the moment for import of sales orders. In order to import a sales order using Excel the appropriate tables will be used.
Assumption: The assumption is that appropriate reference data such as customers, etc. was created in advance.
Data Model:
Table Name | Table Description |
SalesTable | The SalesTable table contains all sales order headers regardless of whether they have been posted. |
SalesLine | The SalesLine table contains all sales order lines regardless of whether they have been posted. |
Data Model Diagram:

Walkthrough:
Connection
Add Data
Error

Solution
-Add replacement key to CreditCardCust table
-Add replacement key to AgreementHeader table
-Add replacement key to SourceDocumentHeader table
-Add replacement key to DocuValue table
-Add replacement key to CustInvoiceLineIdRef table
-Add replacement key to MarkupTrans table
-Add replacement key to CustInvoiceLineTemplate table
-Add replacement key to BankLC table
Error

No Solution yet
Add Tables

Field Chooser

Sales order ID number sequence

SalesTable
Field Name | Field Description |
Currency | |
Customer account | |
Customer group | |
Invoice account | |
Language | |
Requested ship date | |
Sales order |

SalesLine
Field Name | Field Description |
Sales order | |
Currency | |
Customer | |
Group | |
Requested ship date | |
Source document line.Reference table ID | |
Item number | |
Quantity | |
Unit price | |
Net amount | |
Dimension No. |

InventDim

Excel VLookup function may be used to find appropriate InventDimId automatically based on criteria
Sequence:
1.SalesTable - Publish Selected
2.SalesLine – Publish Selected
Result:
Dynamics AX – Sales Order

Dynamics AX – Sales Order Invoice
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 sales orders into Microsoft Dynamics AX 2012. Although Sales Order AIF Web Service (SalesSalesOrderService) can’t be used at the moment in Excel for import of sales orders, appropriate tables can be used instead. Excel template can be created and used for import of sales orders.
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, Sales orders.
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.
Dynamics AX 2012 Free text invoices Import using Excel Add-in
Purpose: The purpose of this document is to illustrate how to use Microsoft Dynamics AX 2012 Excel Add-in for import of free text invoices.
Challenge: Data model changes in Microsoft Dynamics related to high normalization and introduction of surrogate keys made some imports more complex. The data model forming Free text invoices was not dramatically changed and import principle remains the same – populate the header and related lines. In fact the link between the header and lines in build based on RecID which adds complexity.
Solution: Microsoft Dynamics AX 2012 ships with Free Text Invoice AIF Web Service (CustFreeTextInvoiceService) which can be used in integration scenarios. However Free Text Invoice AIF Web Service can’t be used in Excel at the moment for import of free text invoices. In order to import a free text invoices using Excel the appropriate tables will be used.
Assumption: The assumption is that appropriate reference data such as customers, etc. was created in advance.
Data Model:
Table Name | Table Description |
CustInvoiceTable | The CustInvoiceTable table contains free text invoices. |
CustInvoiceLine | The CustInvoiceLine table contains line items for an accounts receivable free text invoice. |
Data Model Diagram:

Walkthrough:
Connection
Add Data

Error

Solution
-Add replacement key to CustInvoiceTable table
-Add replacement key to CustInvoiceLine table
Error


Data Model Changes

Temporary Key (Import ID)

ImportID is custom String field that is introduced to overcome the problem with Surrogate key based relations between tables in Excel add-in. Index1 is as I call it “Temporary Key” used during data conversion (data migration) process only. This Temporary key will be assigned to the header table as Non Surrogate Replacement key.

Lines table will still have relation to header table based on Surrogate key.

But because header table has Natural Replacement key Excel add-in will be able to translate Surrogate key based relation into Natural Key relation as design time (data entry) and vice versa, Natural Key relation to Surrogate key relation, during run time (publishing).

Proxy AIF classes
Table | Class |
CustInvoiceTable | AxCustInvoiceTable |
CustInvoiceLine | AxCustInvoiceLine |
In order to regenerate Proxy AIF classes involved into Free text invoices import I used AIF Free Text Invoice Web Service (CustFreeTextInvoiceService) Update document service function available through Tools > AIF > Update document service in Development Workspace.

As the result appropriate AIF Proxy classes will be updated or created to support the translation ImportID - RecID.
Generate Incremental CIL

Add Tables

Field Chooser

CustInvoiceTable
Field Name | Field Description |
Currency | |
Customer account | |
Date | |
Group | |
Import ID | |
Invoice account | |
Language |

CustInvoiceLine
Field Name | Field Description |
Customer free text invoice.Import ID | |
Description | |
LedgerDimension.Main account | |
Quantity | |
Unit price | |
Amount |

Sequence:
1.CustInvoiceTable - Publish Selected
2.CustInvoiceLine – Publish Selected
Result:
Dynamics AX – Free text invoice

Dynamics AX – Free text invoice (Invoice)
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 free text invoices into Microsoft Dynamics AX 2012. Although Free Text Invoice AIF Web Service (CustFreeTextInvoiceService) can’t be used at the moment in Excel for import of free text invoices, appropriate tables can be used instead. Excel template can be created and used for import of free text invoices.
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, Free text invoices.
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.
Dynamics AX 2012 Purchase orders Import using Excel Add-in
Purpose: The purpose of this document is to illustrate how to use Microsoft Dynamics AX 2012 Excel Add-in for import of purchase orders.
Challenge: Data model changes in Microsoft Dynamics related to high normalization and introduction of surrogate keys made some imports more complex. In fact the data model forming Purchase Orders was not dramatically changed and import principle remains the same – populate the header and related lines. However some information which is usually automatically generated in Microsoft Dynamics AX 2012 Rich Client by means of number sequences such as purchase order ID will have to be provided.
Solution:
Assumption: The assumption is that appropriate reference data such as vendors, etc. was created in advance.
Data Model:
Table Name | Table Description |
PurchTable | The PurchTable table contains all the purchase order headers regardless of whether they have been posted. |
PurchLine | The PurchLine table contains all purchase order lines regardless whether they have been posted or not. |
Data Model Diagram:

Walkthrough:
Connection
Error


Add Tables

Field Chooser

Purchase order ID number sequence

PurchTable
Field Name | Field Description |
Currency | |
Invoice account | |
Language | |
Purchase order | |
Vendor account | |
Vendor group |

PurchLine
Field Name | Field Description |
Currency | |
Group | |
Lot ID | |
Purchase order | |
Vendor account | |
Item number | |
Quantity | |
Unit price | |
Net amount | |
Dimension No. |

InventDim

Excel VLookup function may be used to find appropriate InventDimId automatically based on criteria
Sequence:
1.SalesTable - Publish Selected
2.SalesLine – Publish Selected
Result:
Dynamics AX – Purchase Order

Dynamics AX – Purchase Order Invoice
SQL Trace:
Summary:
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, Purchase orders.
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.
Dynamics AX 2012 Data Import using Excel Add-in
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.
Dynamics AX 2012 Excel Add-in - Issues and Solutions
Dynamics AX 2012 Excel Add-in – Issues and Solutions
Purpose: The purpose of this document is to outline some issues you may encounter when using Dynamics AX 2012 Excel Add-in for import of data and provide solutions to resolve them.
Issue: “This operation is not supported for a relative URI”.
Reason: This issue occurs because AppFabric Service Bus endpoint is not configured. AppFabric Service Bus endpoints are similar to WCF endpoints. The only difference is that specific binding are used to communicate with relay service. The ‘sb’ represents the scheme used to communicate with the AppFabric Service Bus. The scheme can be either ‘http’ or ‘sb’ depending on the binding you are using. Endpoints can be configured in application configuration files or programmatically. Alternatively you can delete the endpoint if you don’t use it.
Dynamics AX Error
Solution: Please delete or configure ‘sb’ endpoint. ‘sb’ endpoint has no address defined which is treated by Dynamics AX Excel Add-in as relative URI. Below I show how to delete ‘sb’ endpoint.
Microsoft Dynamics AX Configuration Utility
Opening Microsoft Service Configuration Editor dialog
WCF Configuration Editor
Save Changes to WCF Configuration
Restart Excel
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, Issue, Problem, Solution, Resolution.
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 issues and describe the solutions.
Dynamics AX 2012 Excel Add-in - Replacement Keys
Dynamics AX 2012 Excel Add-in – Replacement Keys
Purpose: The purpose of this document is to illustrate options how to change Dynamics AX 2012 Data Model by adding appropriate Replacement keys to make Excel Add-in working to import the data.
Challenge: Data model changes in Dynamics AX related to high normalization and introduction of surrogate keys made import of data more complex. Currently Excel Add-in has a number of limitations as it relates to the Data Model. In order to allow Excel Add-in to interpret Surrogate key relations between tables correctly the specification of Replacement key (Natural key) is required.
Solution: Dynamics AX 2012 ships with close to 4500 tables. Some tables were designed and implemented for previous releases; some of them were designed and implemented for the current release. “New” tables leverage inheritance, Surrogate keys and relations based on Surrogate keys when “old” tables still have Natural keys and relations based on Natural keys. Please also note that for all newly created tables relations between tables in Dynamics AX 2012 should be specified on table level, at the same time some relations are still specified on “old” EDT’s in the system.
The example of “new” tables would be AgreementHeader and AgreementLine tables. AgreementLine table is linked with AgreementHeader table by Foreign key which is Surrogate key based.
The example of “old” tables would be LedgerJournalTable and LedgerJournalTrans tables. LedgerJournalTable table has Primary key based on JournalNum field (Natural key) and this JournalNum field is used to link LedgerJournalTable and LedgerJournalTrans tables together. That’s why in this case there’s no need to tweak the Data Model to make Excel Add-in working.
Table Name | Table Description |
AlexTable | Sample header table |
AlexLine | Sample lines table |
Data Model Diagram:
Sample Data Model
Walkthrough:
Connection
Add Tables
Dynamics AX Error
Header AlexTable table
Solution – Option 1 (this is what I implemented in this example): Use existing field(s) which will form unique Natural key
-Add Replacement key to AlexTable table
Solution – Option 2: Introduce brand new field(s) which will form unique Natural key
-Add Replacement key to AlexTable table
Dynamics AX Error
Lines AlexLine table
Solution – Option 1: Use existing field(s) which will form unique Natural key
-Add Replacement key to AlexLine table
Solution – Option 2: Introduce brand new field(s) which will form unique Natural key
-Add Replacement key to AlexLine table
-Add Replacement key to AlexLine table
The easiest option is Solution – Option 3 using one of existing fields and RecID field.
If your Replacement key would contain only RecId this would not be different from Surrogate key, RecId adds uniqueness to the index and if RecID is complimented with another non-RecID field then we have unique non-Surrogate key. However sometimes your table which requires Replacement key assignment may not even have fields other than system fields such as RecID or CreatedBy, ModifiedBy, etc. This may happen with tables participating in table inheritance. In this case new field may be added to the table. Then you can implement Solution – Option 2 with brand new field – ImportID in my examples. Please note that your unique index will be based on this field which means that you will have to populate this field with unique values for all existing records if any. The easiest way is to write X++ job and populate this new field (String) based on RecId values in the same table. Going forward unique values for that field will have to be provided in Excel Add-in interface explicitly.
Solution – Option 1 will work only if you already have existing field or combination of fields in the table which could be your Primary key. However this approach is not universal because all depends on the purpose of particular fields in the table.
Project
AlexTable table
Query
Select Code Generation Parameters
Generate Incremental CIL
If you encounter this error
please delete cache* methods
Field Chooser
This is how Field Chooser will look like if you use Index1 = {ID} as Replacement key in header AlexTable table. Please note that ID field in AlexTable table is used for Replacement Key <-> Surrogate Key translation
This is how Field Chooser will look like if you use Index1 = {FieldA, RecID} as Replacement key in header AlexTable table. Please note that FieldA field in AlexTable table is supposed to be used for Replacement Key <-> Surrogate Key translation
Conclusion: All Replacement key Options including [existing field(s) + RecID] are applicable for lines (derived) AlexLine table. And all Replacement key Options excluding [existing field(s) + RecID] are applicable for header (main) AlexTable table.
AlexTable
Field Name | Field Description |
ID | |
A | |
B |
AlexLine
Field Name | Field Description |
AlexTable.ID | |
C | |
D |
Sequence:
1.AlexTable – Publish Selected
2.AlexLine – Publish Selected
Result:
Dynamics AX – Table Browser
AlexTable
SQL Trace:
Document Services
Document Services are based on a query that defines their structure. Only certain query structures are supported. The following are the restrictions on queries that form the basis of document services. Services which violate these rules may be added to the document data sources form by the administrator, but will result in errors when accessed in the add-in. For this reason it is important that developers and administrators test services for use with the add-in prior to adding them to this form.
·Replacement Keys:The root level of the document service (the parent data source) must have unique indexes other than Rec-ID. This may be in the form of a non-RecID Primary Index or a Replacement Key.
·Related Replacement Keys:Each field within the service which is a RecID-based foreign key must relate to a table that has a replacement key specified.
·Relationship Direction:When parent-child relationships exist in the underlying query associated with the service, only relationships originating on the child element, and pointing to the parent may be used. For example, in the CustCustomerService, the CustTable parent data source holds a foreign key to the DirParty child data source. This pattern is not supported in the Excel Add-in.
·Query and Service consistency:Document services are based on an underlying query which defines the data contract used in the service at the time that the service is generated. The Excel Add-in uses this query definition to perform read operations when refreshing data into the workbook. Because of this, any overrides to the read method, or extension of the schema beyond what is in the underlying query will not be reflected in the service.
·ViewSupport:Views may be used within document services to provide an easier to use data model for end users. However, the PrepareForXXXExtended methods must be implemented to properly handle information sent to the service within the views. Views may only be used as the “leaf” level node in the underlying query. For instance if there is a query “Parent, child, grandchild”, then only the grandchild node can be a view.
Only the following services shipped in Microsoft Dynamics AX 2012 are supported without modification in the Excel Add-in. Additional services meeting the above requirements can be constructed in order to extend the scenarios where excel can be used to update, create, and delete business data in Dynamics AX.
·BudgetTransaction
· EMSMeterReading
· EMSSubstanceFlow
· GeneralJournal
· ProductionPickingList
· ProjectHourJournals
· SysImportBusSector
· VendGroup
· VendRequestSignup
Supported tables
Not all tables presented in the “Add tables” dialog may be used with the Excel add-in, rather only those which meet the following requirements:
·Visible Identity:There must be a unique index on the table which does not contain RecID as a component. This may be either the “Replacement Key”, or the “Primary Index”
·Valid References:All relations in the relations collection for the table that refer to other tables via Rec-Id must be related to tables that have a “Replacement Key” specified.
Summary: In order to make Excel Add-in working to import the data the specification of Replacement key is required. Excel Add-in uses Replacement key to interpret Surrogate key based relations between tables. There’s multiple options how to change the Data Model and introduce Replacement key to the table: use existing field(s) which will form unique Natural key, introduce brand new field(s) which will form unique Natural key or create unique Replacement key based on one of the existing fields and RecID field.
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.
Dynamics AX 2012 Purchase Agreements Import using Excel Add-in
Microsoft Dynamics AX 2012 Excel Add-in – Purchase agreements Import
Purpose: The purpose of this document is to illustrate how to use Microsoft Dynamics AX 2012 Excel Add-in for import of purchase agreements.
Challenge: Data model changes in Microsoft Dynamics related to high normalization and introduction of surrogate keys made some imports more complex. Moreover Purchase Blanket orders functionality was completely redesigned and in Microsoft Dynamics AX 2012 it’s called Purchase Agreements now.
Solution: Microsoft Dynamics AX 2012 ships with a number of AIF Web Service which can be used in integration scenarios. However there’s no AIF Web Service out-of-the-box that can be used in Excel at the moment for import of purchase agreements.In order to import a purchase agreement using Excel the appropriate tables will be used.
Assumption: The assumption is that appropriate reference data such as customers, etc. was created in advance.
Data Model:
Table Name | Table Description |
AgreementClassification | The AgreementClassification table contains the agreement classifications. |
AgreementClassificationTranslation | The AgreementClassificationTranslation table contains the translations for the agreement classifications. |
AgreementHeader | The AgreementHeader table contains each of the purchase and sales agreements. |
AgreementHeaderDefault | The AgreementHeaderDefault table contains the release order defaulting policies. |
AgreementHeaderDefaultHistory | The AgreementHeaderDefaultHistory table contains a snapshot of the release order defaulting policies. |
AgreementHeaderHistory | The AgreementHeaderHistory table is a base table for the sales and purchase agreement header history tables. |
AgreementLine | The AgreementLine table stores information about the purchase agreement details. |
AgreementLineDefault | The AgreementLineDefault table contains the line release order defaulting policies. |
AgreementLineDefaultHistory | The AgreementLineDefaultHistory table contains a snapshot of line release order defaulting policies. |
AgreementLineHistory | The AgreementLineHistory table contains a snapshot of the agreement lines. |
AgreementLineQuantityCommitment | The AgreementLineQuantityCommitment table contains each of the agreement lines of the quantity type. |
AgreementLineQuantityCommitmentHistory | The AgreementLineQuantityCommitmentHistory table contains a snapshot of agreement quantity lines. |
AgreementLineReference | The AgreementLineReference table contains the relation between intercompany sales agreement lines and intercompany purchase agreement lines. |
AgreementLineReleasedLine | The AgreementLineReleasedLine table contains released agreement lines. |
AgreementLineReleasedLineHistory | The AgreementLineReleasedLineHistory table contains a snapshot of released agreement lines. |
AgreementLineVolumeCommitment | The AgreementLineVolumeCommitment table contains each of the agreement lines of the volume type. |
AgreementLineVolumeCommitmentHistory | The AgreementLineVolumeCommitmentHistory table contains a snapshot of agreement volume lines. |
AgreementReference | The AgreementReference table contains the relation between intercompany sales agreement headers and intercompany purchase agreement headers. |
AgreementReleaseHeaderMatch | The AgreementReleaseHeaderMatch table contains matchings between agreements and orders. |
PurchAgreementHeader | The PurchAgreementHeader table contains purchase agreement headers. |
PurchAgreementHeaderDefault | The PurchAgreementHeaderDefault table contains the release purchase order defaulting policies. |
PurchAgreementHeaderDefaultHistory | The PurchAgreementHeaderDefaultHistory table contains a snapshot of the release purchase order defaulting policies. |
PurchAgreementHeaderHistory | The PurchAgreementHeaderHistory table contains a snapshot of the purchase agreement header record. |
PurchTable | The PurchTable table contains all the purchase order headers regardless of whether they have been posted. |
PurchLine | The PurchLine table contains all purchase order lines regardless whether they have been posted or not. |
Data Model Diagram:
Agreements
Red area highlights tables forming Agreements – Headers data model
Green area highlights tables forming Agreements – Lines data model
Blue area highlights tables forming Purchase Agreements data model
Release orders
VSD: https://docs.google.com/open?id=0B3rbAZy5q2ExNGNiYzEwODctY2Y4ZC00OGFlLWJiNjMtNDMxMGFjNzc4Nzk2
Walkthrough:
Connection
Add Tables
Dynamics AX Error
Solution:
-Add replacement key to AgreementHeader table
I decided to re-use existing DocumentTitle field as Replacement key without introduction of brand new field (Temporary key) and regeneration of AIF Proxy classes here. That’s why I re-populated DocumentTitle field for all existing records using RecID and assigned Index1 = {DocumentTitle} as Replacement key to AgreementHeader table.
Field Chooser
PurchAgreementHeader
Field Name | Field Description |
Agreement classification.AgreementRelationType | |
Agreement classification.Name | |
Currency | |
Vendor account | |
InstanceRelationType | |
Purchase agreement ID | |
IsDeleted | |
Vendor account.VendorDataAreaId | |
Document title | |
Legal entities.DataArea | |
Legal entities.Name | |
Party ID | |
Legal entities.Party ID | |
Legal entities.Party type |
AgreementLine
Field Name | Field Description |
Dimension No..InventDimDataAreaId | |
Dimension No. | |
Item number | |
Item number.ItemDataAreaId | |
Agreement header record ID.InstanceRelationType | |
Agreement header record ID.Document title | |
Effective date | |
Expiration date | |
InstanceRelationType | |
Line number | |
Quantity | |
Unit | |
Unit price | |
IsDeleted |
InventDim
Excel VLookup function may be used to find appropriate InventDimId automatically based on criteria
Sequence:
1.PurchAgreementHeader - Publish Selected
2.AgreementLine – Publish Selected
Result:
Dynamics AX – Purchase Agreement
Dynamics AX – Release Order
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 purchase agreements into Microsoft Dynamics AX 2012. Although there’s no AIF Web Service out-of-the-box that can be used at the moment in Excel for import of purchase agreements, appropriate tables can be used instead. Excel template can be created and used for import of purchase agreements.
Author: Alex Anikiev, PhD, MCP
Dynamics AX 2012 Sales Agreements Import using Excel Add-in
Microsoft Dynamics AX 2012 Excel Add-in – Sales agreements Import
Purpose: The purpose of this document is to illustrate how to use Microsoft Dynamics AX 2012 Excel Add-in for import of sales agreements.
Challenge: Data model changes in Microsoft Dynamics related to high normalization and introduction of surrogate keys made some imports more complex. Moreover Sales Blanket orders functionality was completely redesigned and in Microsoft Dynamics AX 2012 it’s called Sales Agreements now.
Solution: Microsoft Dynamics AX 2012 ships with a number of AIF Web Service which can be used in integration scenarios. However there’s no AIF Web Service out-of-the-box that can be used in Excel at the moment for import of sales agreements.In order to import a sales agreement using Excel the appropriate tables will be used.
Assumption: The assumption is that appropriate reference data such as customers, etc. was created in advance.
Data Model:
Table Name | Table Description |
AgreementClassification | The AgreementClassification table contains the agreement classifications. |
AgreementClassificationTranslation | The AgreementClassificationTranslation table contains the translations for the agreement classifications. |
AgreementHeader | The AgreementHeader table contains each of the purchase and sales agreements. |
AgreementHeaderDefault | The AgreementHeaderDefault table contains the release order defaulting policies. |
AgreementHeaderDefaultHistory | The AgreementHeaderDefaultHistory table contains a snapshot of the release order defaulting policies. |
AgreementHeaderHistory | The AgreementHeaderHistory table is a base table for the sales and purchase agreement header history tables. |
AgreementLine | The AgreementLine table stores information about the purchase agreement details. |
AgreementLineDefault | The AgreementLineDefault table contains the line release order defaulting policies. |
AgreementLineDefaultHistory | The AgreementLineDefaultHistory table contains a snapshot of line release order defaulting policies. |
AgreementLineHistory | The AgreementLineHistory table contains a snapshot of the agreement lines. |
AgreementLineQuantityCommitment | The AgreementLineQuantityCommitment table contains each of the agreement lines of the quantity type. |
AgreementLineQuantityCommitmentHistory | The AgreementLineQuantityCommitmentHistory table contains a snapshot of agreement quantity lines. |
AgreementLineReference | The AgreementLineReference table contains the relation between intercompany sales agreement lines and intercompany purchase agreement lines. |
AgreementLineReleasedLine | The AgreementLineReleasedLine table contains released agreement lines. |
AgreementLineReleasedLineHistory | The AgreementLineReleasedLineHistory table contains a snapshot of released agreement lines. |
AgreementLineVolumeCommitment | The AgreementLineVolumeCommitment table contains each of the agreement lines of the volume type. |
AgreementLineVolumeCommitmentHistory | The AgreementLineVolumeCommitmentHistory table contains a snapshot of agreement volume lines. |
AgreementReference | The AgreementReference table contains the relation between intercompany sales agreement headers and intercompany purchase agreement headers. |
AgreementReleaseHeaderMatch | The AgreementReleaseHeaderMatch table contains matchings between agreements and orders. |
SalesAgreementHeader | The SalesAgreementHeader table contains all of the sales agreement header specific information. |
SalesAgreementHeaderDefault | The SalesAgreementHeaderDefault table contains the release sales order defaulting policies. |
SalesAgreementHeaderDefaultHistory | The SalesAgreementHeaderDefaultHistory table contains a snapshot of release sales order defaulting policies. |
SalesAgreementHeaderHistory | The SalesAgreementHeaderHistory table contains a snapshot of sales agreement headers. |
SalesTable | The SalesTable table contains all sales order headers regardless of whether they have been posted. |
SalesLine | The SalesLine table contains all sales order lines regardless of whether they have been posted. |
Data Model Diagram:
Agreements
Red area highlights tables forming Agreements – Headers data model
Green area highlights tables forming Agreements – Lines data model
Yellow area highlights tables forming Sales Agreements data model
Release orders
VSD: https://docs.google.com/open?id=0B3rbAZy5q2ExNGNiYzEwODctY2Y4ZC00OGFlLWJiNjMtNDMxMGFjNzc4Nzk2
Walkthrough:
Connection
Add Tables
Dynamics AX Error
Solution:
-Add replacement key to AgreementHeader table
I decided to re-use existing DocumentTitle field as Replacement key without introduction of brand new field (Temporary key) and regeneration of AIF Proxy classes here. That’s why I re-populated DocumentTitle field for all existing records using RecID and assigned Index1 = {DocumentTitle} as Replacement key to AgreementHeader table.
Field Chooser
SalesAgreementHeader
Field Name | Field Description |
Agreement classification.AgreementRelationType | |
Agreement classification.Name | |
Currency | |
Customer account | |
InstanceRelationType | |
Sales agreement ID | |
IsDeleted | |
Customer account.CustomerDataAreaId | |
Document title | |
Legal entities.DataArea | |
Legal entities.Name | |
Party ID | |
Legal entities.Party ID | |
Legal entities.Party type |
AgreementLine
Field Name | Field Description |
Dimension No..InventDimDataAreaId | |
Dimension No. | |
Item number | |
Item number.ItemDataAreaId | |
Agreement header record ID.InstanceRelationType | |
Agreement header record ID.Document title | |
Effective date | |
Expiration date | |
InstanceRelationType | |
Line number | |
Quantity | |
Unit | |
Unit price | |
IsDeleted |
InventDim
Excel VLookup function may be used to find appropriate InventDimId automatically based on criteria
Sequence:
1.SalesAgreementHeader - Publish Selected
2.AgreementLine – Publish Selected
Result:
Dynamics AX – Sales Agreement
Dynamics AX – Release Order
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 sales agreements into Microsoft Dynamics AX 2012. Although there’s no AIF Web Service out-of-the-box that can be used at the moment in Excel for import of sales agreements, appropriate tables can be used instead. Excel template can be created and used for import of sales agreements.
Author: Alex Anikiev, PhD, MCP
Dynamics AX 2012 Excel Add-in - Add Data
Dynamics AX 2012 Excel Add-in – Add Data
Purpose: The purpose of this document is to illustrate how to enable AIF Web Service for Dynamics AX 2012 Excel Add-in.
Task: In order to enable AIF Web Service for Dynamics AX 2012 Excel Add-in 2 main prerequisites have to be met: AIF Web Service has to be deployed as a part of Service Group and AIF Web Service has to be added to Document Data Sources. This document describes the sequence of steps on how to enable existing (standard) or brand-new (custom) AIF Web Service for Dynamics AX 2012 Excel Add-in.
Data Model:
Table Name | Table Description |
AlexTable | Sample table |
Data Model Diagram:
Sample Data Model
Walkthrough:
Existing (standard) AIF Web Service
In this demonstration I will enable existing VendVendTableService (Vendor) AIF Web Service for Dynamics AX 2012 Excel Add-in
At the beginning VendVendTableService AIF Web Service is not available in Excel Add-in
In order to deploy VendVendTableService AIF Web Service I will add it to AccountsPayableServices Service Group which is currently not deployed
I added VendVendTableService AIF Web Service to AccountsPayableService Service Group in AOT and then deployed Service Group
After Service Group is deployed you will see the following infolog
Now Service Group will be activated in Inbound ports form in Administration > Setup > AIF
Please note that you can see WSDL in Web Browser as shown below
Finally VendVendTableService AIF Web Service has to be added to Document Data Sources form
Result:
VendVendTableService AIF Web Service is now available in Excel Add-in
Brand-new (custom) AIF Web Service
In this demonstration I will create custom AlexQueryService AIF Web Service
Project
Create Document Service
Welcome
Select document parameters
Select code generation parameters
Generate code
Completed
AxdAlexQuery Project
Generate incremental CIL
AIF Web Service
Add AIF Web Service to Service Group
Deploy Service Group
After Service Group is deployed you will see the following infolog
AlexServiceGroup will now be activated in Inbound ports form
Also you can see WSDL in Web Browser
Finally you will have to add AIF Web Service in Document data sources form
Result:
AlexQueryService AIF Web Service is now available in Excel Add-in
Summary: In order to enable AIF Web Service for Dynamics AX 2012 Excel Add-in 2 main prerequisites have to be met: AIF Web Service has to be deployed as a part of Service Group from AOT or from Inbound ports form in Administration > Setup > AIF and AIF Web Service has to be added to Document Data Sources on Document data sources form in Organization administration > Setup > Document management. You can add your AIF Web Service to newly created custom Service Group for deployment, or you can add your AIF Web Service to existing Service Group and redeploy it.
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, Web Service, Add Data.
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.
Dynamics AX 2012 Excel Add-in - Storage Dimensions
Dynamics AX 2012 Excel Add-in - Storage Dimensions
Purpose: The purpose of this document is to illustrate how to work with Storage Dimensions in Dynamics AX 2012 Excel Add-in.
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 handling Inventory dimensions. AX Rich Client is obviously more dynamic comparing to Excel. AX Rich Client has a number of specialized classes to support Inventory dimensions related operations and UI.
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 manipulate with Storage Dimensions using Excel the appropriate tables can be used. In my example I’ll import required Storage Dimensions, then import Sales Orders information and specify Storage Dimensions related to Sales Order line.
Data Model:
Table Name | Table Description |
InventSite | The InventSite table contains information about sites. |
InventLocation | The InventLocation table contains information about warehouses. |
WMSLocation | The WMSLocation table contains information about locations. |
WMSPallet | The WMSPallet table contains information about pallets. |
InventDim | The InventDim table contains values for inventory dimensions. |
InventSum | The InventSum table contains information about the present and expected on-hand stock of items. |
Data Model Diagram:
Inventory Dimensions
Red area highlights tables forming Product Dimensions data model
Green area highlights tables forming Storage Dimensions data model
Blue area highlights tables forming Tracking Dimensions data model
Storage Dimensions
In Rich Client when Inventory Dimensions are specified, for example, on Sales order line or Purchase order line the system will automatically create InventDim table record and allocate InventDimId value if specified combination of inventory dimensions doesn’t exist in InventDim table yet, otherwise existing InventDimId which corresponds to the specified combination will be re-used. This means that the system will not create InventDim table record for the combination which is not yet used. If you create Sales order line or Purchase order line programmatically using X++ you would use Tables\InventDim\findOrCreate method to assign proper InventDimId to SalesLine table buffer or PurchLine table buffer.
In Excel Add-in there’s no dedicated control related to InventDimId EDT (InventDimId field) yet to enable automatic creation of InventDim table record based on Inventory Dimensions - “segments”. I would anticipate that we have something similar to Excel Add-in segmented control for DimensionDynamicAccount EDT (LedgerDimension field).
InventDimId field lookup | LedgerDimension field lookup |
If you modify AutoLookup field group in InventDim table to include {InventDimId, ConfigId, InventSizeId, InventColorId, InventSiteId, InventLocationId, WMSLocationId, WMSPalletId, InventBatchId, InventSerialId} fields then you can get full list of Inventory Dimensions displayed on Excel Add-in lookup form, however you will still have to specify existing InventDimId before you can create Sales order line or Purchase order line for specific combination of Inventory Dimensions.
In order to resolve this problem appropriate combinations of Inventory Dimensions will have to be created upfront and then Excel VLOOKUP function can be used to pull out the particular InventDimId and apply it to specific Sales order line or Purchase order line.
Excel Add-in can be used to create combinations of Inventory Dimensions in InventDim table.
Alternatively you can write X++ job that will programmatically create desired combinations of Inventory Dimensions for you. Please see the example of X++ job below
Storage Dimensions in Dynamics AX 2012 are Site, Warehouse, Location and Pallet.
Storage Dimensions Walkthrough:
Connection
Add Tables
Field Chooser
InventSite
Field Name | Field Description |
Site | |
Name |
SiteReqPolicy
Field Name | Field Description |
Site | |
Use transfer journals for movements within site |
InventLocation
Field Name | Field Description |
Site | |
Warehouse | |
Name |
Result
Dynamics AX – Site
Dynamics AX – Warehouse
Add Tables
Field Chooser
InventDim
Field Name | Field Description |
<unbound> | Combination |
InventDim.InventDimId | Dimension No. |
InventDim.InventSiteId | Site |
InventDim.InventLocationId | Warehouse |
Please note that I added unbound Combination field into Ax_InventDim table
Combination field is simple concatenation of 2 strings {Site, Warehouse} with “” delimiter in the middle. This field will be used in VLOOKUP function during the import of Sales Order lines in order to put correct InventDimId value in SalesLine.InventDimId field.
Usually when you are doing Data Import you either don’t have InventDimId easily accessible or you do by opening Table Browser or another Excel tab with InventDim table data, and ultimately anyways you’ll have to copy and paste InventDimId value into, for example, SalesLine.InventDimId field.
In fact you will always have an information about what Site and Warehouse (in my example) this Sales Order line should belong to even not having InventDimId value.
That’s why I’m going introduce similar Combination field in Ax_SalesLine table to compare it against Combination field in Ax_InventDim table and automatically put required InventDimId value in SalesLine.InventDimId without a need to manually do copy and paste.
Publish Selected – InventDim
Result
Dynamics AX – Table Browser
Sales order ID number sequence
SalesTable
Field Name | Field Description |
Currency | |
Customer account | |
Customer group | |
Invoice account | |
Language | |
Requested ship date | |
Sales order |
SalesLine
Field Name | Field Description |
<unbound> | Combination |
Currency | |
Customer | |
Group | |
Requested ship date | |
Sales order | |
Item number | |
Quantity | |
Unit | |
Unit price | |
Net amount | |
SalesLine.InventDimId | Dimension No. |
<unbound> | Site |
<unbound> | Warehouse |
Please note that I added similar unbound Combination field into Ax_SalesLine table. The difference here is that Site and Warehouse fields in Ax_SalesLine table are also unbound. Again, usually you have the information about Site and Warehouse (in my example) particular Sales Order line should belong, but you don’t have InventDimId value itself. This becomes critical when you have a lot of combinations of Inventory Dimensions to be introduced into the system as a part of Data Import which will support Sales Order lines.
Similarly Combination field is simple concatenation of 2 strings {Site, Warehouse} with “” delimiter in the middle and it will be used in comparison against Combination field in Ax_InventDim table in order to put correct InventDimId value into SalesLine.InventDimId field.
Publish Selected – Sales Line
Please note that bound InventDimId field in SalesLine table has a formula associated that uses VLOOKUP function. This is how we compare Combination fields in Ax_InventDim and Ax_SalesLine tables to find out about correct InventDimId value to be used in SalesLine.InventDimId field.
By other words, I’m looking for the value from Combination field from Ax_SalesLine table (1st parameter) in Ax_InventDim table (2nd parameter). If exact match (4th parameter) was found then the value in 2nd column (3rd parameter) will be returned as the result.
Please note that by default the category in InventDimId field is Text which has to be changed to General to be able to apply the formula.
Please note that there’re number of prerequisites in order to apply VLOOKUP formula correctly.
Important:
1.Combination field has to be left-most field in Ax_SalesLine table
2.No duplicate values are allowed in Combination field in Ax_InventDim table because we are looking for the exact match
3.You can use static named ranges, absolute cells coordinates or table name(s) in Excel to effectively define table_array value (2nd parameter in VLOOKUP function)
You may define Filter criteria to fetch only certain InventDim table records into Ax_InventDim table in Excel. Consequently it may happen that there’s no match found in Ax_InventDim table, so Excel will put #NA value into the cell. In order to substitute #NA (Not Available) to something more meaningful you can change VLOOKUP formula to be
=IF(ISNA(VLOOKUP([Combination],Ax_InventDim,2,FALSE)),"AllBlank",VLOOKUP([Combination],Ax_InventDim,2,FALSE))
Please note that “AllBlank” represents the record in InventDim table which has no Inventory Dimensions defined
After Sales Order line(s) information gets published the system will reread the information and display the results to you, consequently you will have a value displayed in InventDimId field in SalesLine table instead of VLOOKUP formula.
Result:
Dynamics AX – Sales Order
Dynamics AX – Sales Order Invoice
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 there’s no AIF Web Service to import Inventory Dimensions combinations (into InventDim table) upfront, 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, Inventory Dimensions, Storage Dimensions.
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.
Dynamics AX 2012 Excel Add-in - Customer transactions import
Microsoft Dynamics AX 2012 Excel Add-in – Customer transactions Import
Purpose: The purpose of this document is to illustrate how to use Microsoft Dynamics AX 2012 Excel Add-in for import of customer transactions with required level of detail.
Challenge: Data model changes in Microsoft Dynamics related to high normalization and introduction of surrogate keys made some imports more complex. In fact the data model forming General Journal was not dramatically changed and import principle remains the same – populate the journal and then post the journal. Numerous fields are available on General Journal line level in Rich client to achieve required level of detail during import. In order to import customer transactions with required level of detail using Excel Add-in some additional work may be required.
Solution: Microsoft Dynamics AX 2012 ships with General Journal AIF Web Service (LedgerGeneralJournalService) which can be used in integration scenarios. Also General Journal AIF Web Service can be used in Excel for import of customer transactions. However General Journal AIF Web Service may not expose all fields which may be required for import such as Invoice, etc. In this walkthrough in order to import customer transactions using Excel the appropriate tables will be used instead. Some additional work will be done after initial import to align customer account.
Assumption: The assumption is that appropriate reference data such as customers, etc. was created in advance.
Data Model:
Table Name | Table Description |
LedgerJournalTable | The LedgerJournalTable table contains all the defaulting and state information pertaining to a single journal. The transaction details of a journal are managed in the LedgerJournalTrans table. |
LedgerJournalTrans | The LedgerJournalTrans table contains the transaction detail information that pertains to a single journal. The individual transaction lines are also referred to as voucher lines. The journal is a record in the LedgerJournalTable table. |
Data Model Diagram:
Walkthrough:
AxdLedgerGeneralJournal Query
General Journal AIF Web Service doesn’t expose all fields which may be required for import such as Invoice, etc.
In order to bring Customer account information over to AX I introduced CustAccount field into LedgerJournalTrans table as shown below
CustAccount field is based on CustAccount EDT which in its turn has relation to CustTable table
After mentioned customizations will be introduced you will have to regenerate AIF Proxy classes in order to reflect changes in the data model. I used LedgerGeneralJournalService AIF Web Service because it has LedgerJournalTable and LedgerJournalTrans tables as data sources, this is exactly the tables I need AIF Proxy classes to be regenerated for.
Update document service
After you complete steps required to Update document service as it’s described in “Import Data” walkthrough you will need to generate incremental CIL.
Generate Incremental CIL
Connection
Add Tables
Dynamics AX Error
Solution:
-Add replacement key to VendTrans table {Field, RecId}
-Add replacement key to CustTrans table {Field, RecId}
-Add replacement key to LedgerJournalTrans table {Field, RecId}
-Add replacement key to ReasonTableRef table {Field, RecId}
-Add replacement key to VendBankAccount table {Field, RecId}
-Add replacement key to CustBankAccount table {Field, RecId}
-Add replacement key to BudgetSource table {Field, RecId}
-Add replacement key to BudgetTransactionLine table {Field, RecId}
Field Chooser
Accounting structure
Dynamics AX Error
When you unpress Field Chooser button you may see “The number of joins in the statement is X. This exceeds the maximum of 26. …” error
This error occurs because of numerous relations specified on LedgerJournalTrans and LedgerJournalTable tables. As opposite to AIF Web Service where the data set is strictly defined by the Query, in the case when raw tables are being used the system is building composite data set based on relations specified on tables/EDT level
In order to bypass this error you will have to change “Maximum buffer size (KB)” setting in Dynamics AX Server Configuration Utility and restart AX AOS
Dynamics AX Server Configuration Utility
LedgerJournalTable
Field Name | Field Description |
Journal batch number | |
Name | |
Description |
LedgerJournalTrans
Field Name | Field Description |
Journal batch number | |
Voucher | |
Date | |
Company accounts | |
Account type | |
LedgerJournalTrans.CustAccount <custom> | Customer account |
DefaultDimension.Department | |
Description | |
Debit | |
Credit | |
Currency | |
LedgerJournalTrans.Invoice | Invoice |
Offset company accounts | |
Offset account type | |
OffsetLedgerDimension | |
OffsetLedgerDimension.Main Account | |
OffsetLedgerDimension.Department | |
Offset-transaction text |
Please note that I added Invoice fieldwhich is not included in General Journal AIF Web Service data set by default. Also to manipulate with Customer account I added custom CustAccount field, after initial import this field will be used in X++ Job to populate LedgerDimension field in LedgerJournalTrans table based on Customer account specified. In my previous walkthroughs I used different approach which doesn’t require the customization of AX data model (the structure of LedgerJournalTrans table) when I used Description field to bring Customer account info over to AX.
When you will try to publish LedgerJournalTrans table data you will see “Method AxdBase.getDimensionId must be overridden” error
Dynamics AX Error
This error occurs because there’s no behavior defined in Generic document AIF document class (AxdGenericDocument) which is used when you work with raw tables as it relates to LedgerDimension field(s) processing.
Please note that General Journal AIF document class does have this behavior defined, that’s why it can handle LedgerDimension field(s) fine.
Actually the actual LedgerDimension field(s) handling happens during deserialization in AxdLedgerGeneralJournal class, here in getDimensionId method the values get stored for future processing.
Solution:
The next logical step is to override getDimensionId method in AxdGenericDocument class assuming that we just want to import customer transactions for now
However with this code (stub) we can bypass the error but not populate LedgerDimension field(s) values appropriately. In order to populate LedgerDimension field(s) values I modified this method to look like the following
This will take care of populating Offset account on General Journal line level properly when using raw tables. Please note that Customer account field will be populated separately and then X++ job will be used to populate appropriate LedgerDimension value which corresponds to particular Customer account.
X++ Job
Sequence:
1.LedgerJournalTable – Publish Selected
2.LedgerJournalTrans – Publish Selected
Result:
Dynamics AX – General Journal
Dynamics AX – Execute X++ Job
Dynamics AX – General Journal lines
Dynamics AX – General Ledger Posting
Alternatives:
Alternatively General Journal AIF Web Service (LedgerGeneralJournalService) Query may be modified to accommodate for more fields required for import such as Invoice, etc. This approach is much easier to implement by the user.
After you customize the Query document service must be updated using Update document service function in Developer workspace and then incremental CIL must be generated.
As an alternative to introduction of brand new field CustAccount to bring over Customer account information to AX you can make use LedgerDimension.MainAccount field.
LedgerJournalTrans
This trick will require the customization of AxdGenericDocument AIF document class in order to handle special behavior associated with LedgerDimension field(s) (LedgerDimension, OffsetLedgerDimension) as shown below
Here I assume that in Account field I specify Customer account and in Offset account field I specify Ledger account (Clearing account).
Using these ideas to facilitate import effort the same result will be achieved! The difference is in the amount of customizations introduced in order to import the data.
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 customer transactions into Microsoft Dynamics AX 2012. General Journal AIF Web Service (LedgerGeneralJournalService) can be used in Excel for import of customer transactions. However General Journal AIF Web Service (LedgerGeneralJournalService) doesn’t expose all fields which may be required for import. In this case General Journal AIF Web Service (LedgerGeneralJournalService) Query may be customized to accommodate for more fields, or raw tables may be used instead. Excel template can be created and used for import of customer transactions.
In this document raw tables approach was implemented to import customer transactions with required level of detail to demonstrate the mechanics of the process. In another similar walkthrough dedicated to import of vendor transactions with required level of detail I’ll focus on General Journal AIF Web Service modification approach which is much easier to implement for the user.
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, Customer transactions.
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. Please remove all Data Model changes introduced as a part of this demonstration once you complete data import exercise.
Dynamics AX 2012 Excel Add-in - Vendor transactions import
Microsoft Dynamics AX 2012 Excel Add-in – Vendor transactions Import
Purpose: The purpose of this document is to illustrate how to use Microsoft Dynamics AX 2012 Excel Add-in for import of vendor transactions with required level of detail.
Challenge: Data model changes in Microsoft Dynamics related to high normalization and introduction of surrogate keys made some imports more complex. In fact the data model forming General Journal was not dramatically changed and import principle remains the same – populate the journal and then post the journal. Numerous fields are available on General Journal line level in Rich client to achieve required level of detail during import. In order to import vendor transactions with required level of detail using Excel Add-in some additional work may be required.
Solution: Microsoft Dynamics AX 2012 ships with General Journal AIF Web Service (LedgerGeneralJournalService) which can be used in integration scenarios. Also General Journal AIF Web Service can be used in Excel for import of vendor transactions. However General Journal AIF Web Service may not expose all fields which may be required for import such as Invoice, etc. In this walkthrough in order to import vendor transactions using Excel I’m going to modify General Journal AIF Web Service (LedgerGeneralJournalService), alternatively the appropriate tables may be used instead. Please note that I’ll make use of Main account field to bring Vendor account information over to Microsoft Dynamics AX 2012, so no additional work will be required to align vendor account comparing to similar walkthrough where I import customer transactions using raw tables.
Assumption: The assumption is that appropriate reference data such as vendors, etc. was created in advance.
Data Model:
Table Name | Table Description |
LedgerJournalTable | The LedgerJournalTable table contains all the defaulting and state information pertaining to a single journal. The transaction details of a journal are managed in the LedgerJournalTrans table. |
LedgerJournalTrans | The LedgerJournalTrans table contains the transaction detail information that pertains to a single journal. The individual transaction lines are also referred to as voucher lines. The journal is a record in the LedgerJournalTable table. |
Data Model Diagram:
Walkthrough:
AxdLedgerGeneralJournal Query
General Journal AIF Web Service doesn’t expose all fields which may be required for import such as Invoice, etc.
In order to get access to more fields for vendor transactions import when using General Journal AIF Web Service AxdLedgerGeneralJournal Query will have to be modified appropriately
That’s why I added Invoice field into the list of fields for LedgerJournalTrans data source
Please note that Invoice field is already included in LedgerJournalTrans table and has appropriate support in AxLedgerJournalTrans AIF Proxy class
So there’s no need to Update document service (LedgerGeneralJournalService) and regenerate AIF Proxy class(es). However in order to enable Invoice field to be used by General Journal AIF Web Service appropriate Service Group (LedgerServices) which contains LedgerGeneralJournalService AIF Web Service will have to be redeployed.
Once LedgerServices Service Group is redeployed you will see the following infolog
You can also see LedgerServices Service Group activated in Inbound ports form in Administration > Setup > Application Integration Framework
Please note that if you will manually create Enhanced port, say LedgerServicesAlex
And then select “create” operation on LedgerGeneralJournalService AIF Web Service in Select service operations form
Eventually you will be able to see Invoice field listed in Document data policies form
This is a proof that Invoice field will now be available for use by General Journal AIF Web Service
Connection
Add Data
Field Chooser
Accounting structure
LedgerJournalTable
Field Name | Field Description |
Journal batch number | |
Name | |
Description |
LedgerJournalTrans
Field Name | Field Description |
Journal batch number | |
Voucher | |
Date | |
Company accounts | |
Account type | |
LedgerDimension | |
LedgerDimension.Main Account | |
LedgerDimension.Department | |
DefaultDimension.Department | |
Description | |
Debit | |
Credit | |
Currency | |
LedgerJournalTrans.Invoice | Invoice |
Offset company accounts | |
Offset account type | |
OffsetLedgerDimension | |
OffsetLedgerDimension.Main Account | |
OffsetLedgerDimension.Department | |
Offset-transaction text |
Sequence:
1.GeneralJournalService – Publish All
Result:
Dynamics AX – General Journal
Dynamics AX – General Journal lines
Please note that Invoice field is properly propagated on Invoice tab
Dynamics AX – General Ledger Posting
It’s important to mention that I used Main account field to bring over Vendor account information to Microsoft Dynamics AX 2012 without any customizations. This is possible because AxdLedgerGeneralJournal document class has the logic to assign appropriate LedgerDimension value based on value specified in Main account field and actual Account type defined (in our case it’s Vendor) in afterDeserializeEntity method as shown below
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 vendor transactions into Microsoft Dynamics AX 2012. General Journal AIF Web Service (LedgerGeneralJournalService) can be used in Excel for import of vendor transactions. However General Journal AIF Web Service (LedgerGeneralJournalService) doesn’t expose all fields which may be required for import. In this case General Journal AIF Web Service (LedgerGeneralJournalService) Query may be customized to accommodate for more fields, or raw tables may be used instead. Excel template can be created and used for import of vendor transactions.
In this document I modified General Journal AIF Web Service (LedgerGeneralJournalService) to import vendor transactions with required level of detail. In another similar walkthrough dedicated to import of customer transactions with required level of detail I’ll use raw tables approach to illustrate the mechanics of the process better. Raw tables approach is much more complex than AIF Web Service modification approach for the user.
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, Vendor transactions.
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.