29
1 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012 Microsoft Dynamics ® AX 2012 Data Migration for Microsoft Dynamics AX 2012 White Paper Microsoft Dynamics AX 2012 includes many different ways to import data into the system. Because the Microsoft Dynamics AX 2012 data model was normalized, choosing an import method can be challenging. This document provides guidance about which import method to choose for specific situations. Date: February 2012 www.microsoft.com/dynamics/ax Patrick Nelson, Solution Architect Send suggestions and comments about this document to [email protected]. Please include the title with your feedback.

DataMigration_AX2012

  • Upload
    koggen

  • View
    2.203

  • Download
    8

Embed Size (px)

Citation preview

Page 1: DataMigration_AX2012

1

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Microsoft Dynamics®

AX 2012

Data Migration for Microsoft Dynamics AX 2012

White Paper

Microsoft Dynamics AX 2012 includes many different ways to import data into the system. Because the Microsoft Dynamics AX 2012 data model was normalized, choosing an import

method can be challenging. This document provides guidance about which import method to choose for specific situations.

Date: February 2012

www.microsoft.com/dynamics/ax

Patrick Nelson, Solution Architect

Send suggestions and comments about this document to [email protected]. Please include the title with your

feedback.

Page 2: DataMigration_AX2012

2 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Table of Contents

Introduction ................................................................................................ 3

Data complexity in Microsoft Dynamics AX 2012......................................... 3

Options for importing data into Microsoft Dynamics AX 2012 ..................... 4 Microsoft Dynamics AX import ................................................................................................ 4 Microsoft Excel Add-in for Microsoft Dynamics AX ..................................................................... 5

Using document services with the Excel Add-in to import data ................................................. 5 Using the Excel Add-in to import tables ................................................................................ 5

RapidStart Services ............................................................................................................... 7 AIF, document services, and custom code ................................................................................ 9 Examples of using AIF to import global address book–related data .............................................10

Customer import .............................................................................................................. 10 Vendor import .................................................................................................................. 15 HCMWorker (employee or worker) import ............................................................................ 16 Product-item data management services ............................................................................. 19

Recommended import methods for specific tables and entities ................. 26

Performance considerations...................................................................... 28

Page 3: DataMigration_AX2012

3

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Introduction

Microsoft Dynamics® AX 2012 must be populated with configuration and master data records before an organization can start using it. To minimize data duplication and enable change tracking in Microsoft Dynamics AX, the underlying database schema is quite complex. This complexity can present challenges to system integrators and developers who are migrating data from other systems into Microsoft Dynamics AX.

Data is likely to be imported many times during the life cycle of a system; for example, when you migrate from another system, set up a new test or demonstration environment, or add new

master data. This document is only intended to describe how to perform the initial data load into a new system.

The following table describes the types of data that can be imported or set up in the system.

Type of data Description

System configuration data Data used to set up the Microsoft Dynamics AX environment. This data is not considered part of data migration, but part of your initial setup and configuration. Microsoft Dynamics ERP RapidStart Services can be used to set the system configuration data.

Parameter data Data specific to each module in the environment. This data is typically migrated from a test or staging environment into a production environment. It is not imported from another ERP system.

Master data Entities that describe the parties, locations, products, and activities that are referenced by entities that document and record business events. Examples of this type of data are customers, vendors, products, ZIP Codes/postal codes, payment methods, and delivery methods.

Transactional data Entities that document business events and record their economic value. Examples of this type of data are ledger transactions, customer transactions, and inventory transactions.

Data complexity in Microsoft Dynamics AX 2012

The complexity of the data model in Microsoft Dynamics AX 2012 has increased significantly from previous versions, both because the data model was normalized, and because of other functionality added in Microsoft Dynamics AX 2012. When you import entities, such as customers,

vendors, or sales orders into the system, those entities can map to multiple tables in the database. The options that you can use to import a specific type of entity vary, based on the complexity of the data model that underlies that functionality.

Complexity can also be caused by the need to conform to the principles that underlie the Microsoft

Dynamics AX data model. The following table describes core concepts that impact data model complexity.

Core concept Impact

Table inheritance Table inheritance is a concept that recognizes and represents generalized and specialized relationships between data entities. In Microsoft Dynamics AX 2012, tables can inherit, or extend, from the tables that are situated above them in a hierarchy. A base table contains fields that are common to all tables that are derived from it. A derived table inherits these fields but also contains fields that are unique to its purpose. Each table contains the SupportInheritance and Extends properties, which can be used to control table inheritance. When you import a table that inherits from a base table, you must also import the base table. This is most easily accomplished through code.

Page 4: DataMigration_AX2012

4 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Core concept Impact

Date effectivity Valid time state tables can be used to store and track an object’s history

over its lifetime in Microsoft Dynamics AX 2012. Valid time state tables are often used to track changes to an entity, which requires that some of the data about an entity be stored in a separate table. It is important that you not access valid time state tables directly, but instead use a service abstraction.

Views and normalization A view can be thought of as either a virtual table or a stored query. The data accessible through a view is not stored in the database as a distinct object. What is stored in the database is a SELECT statement. The result set of the SELECT statement forms the virtual table returned by the view. Views are used extensively in Microsoft Dynamics AX to access highly normalized data.

Views are employed by services that reference these constructs to help simplify the programming model and data access patterns.

One-to-many relationships Many Microsoft Dynamics AX entities allow for one-to-many relationships. For example, the global address book allows an unlimited number of addresses and an unlimited amount of contact information to be associated with each party. One-to-many relationships can make it challenging to present information in a tabular format such as a worksheet, where all contact information for a particular party (customer or vendor) is frequently typed on a single line.

Financial dimensions A financial dimension is a data classifier created from the parties, locations, products, and activities in an organization. The master entities, such as customers, vendors, and workers, contain default financial

dimensions that help populate default transaction information.

The underlying storage for dimensions and the associated rules and combinations is complex, and the logic to properly associate dimension attributes with a master entity must be done by calling the correct APIs rather than populating data directly into tables.

Surrogate keys and record IDs Most tables in Microsoft Dynamics AX have a surrogate key, usually the record ID (RecId) of the table, which is used as the primary key. Tables related to the original (parent) table usually have the surrogate key of the parent as a foreign key. RecIdThis provides the benefit of being able to rename items and show friendly names in the user interface while maintaining the data integrity of the stored information. Because RecIds are allocated by the system as data is inserted, maintaining primary key/foreign key relationships without using a service abstraction or APIs is quite difficult and prone to error.

It is often helpful, before you import data into Microsoft Dynamics AX, to review E/R diagrams of the data structures that you will be working with. We recommend that you use either the Application Analysis Tool that is available on InformationSource or the Reverse Engineering tool.

Options for importing data into Microsoft Dynamics AX 2012

This section describes the functionality that is available in Microsoft Dynamics AX 2012 for importing data.

Microsoft Dynamics AX import

Microsoft Dynamics AX import (available from System administration > Common > Data export/import > Import) is the primary mechanism for transferring data between different Microsoft Dynamics AX instances.

You cannot use this import method to migrate data from another ERP system or an older version of Microsoft Dynamics AX. To use this functionality and correctly create definition groups, you

should have a clear understanding of the underlying data model. No business logic can be invoked

to validate or otherwise modify data when you use this functionality. It simply writes the data into the tables exactly as it is in the import file.

Page 5: DataMigration_AX2012

5

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

For more information, see the following resources:

Import initial setup data

Create definition groups for import and export

Microsoft Excel Add-in for Microsoft Dynamics AX

The Microsoft Dynamics AX Add-in for Microsoft® Excel® is a powerful tool for viewing and editing data in Microsoft Dynamics AX 2012. You can use the Excel Add-in with document services or to directly access tables. However, to perform full create, read, and update operations, the data and metadata that are being imported must be organized in very specific patterns. Because of these

restrictions, not all tables or services are supported.

Using document services with the Excel Add-in to import data

Only document services that meet the following requirements can be used with the Excel Add-in to create or update data:

Replacement keys – The root level of the document service (the parent data source) must have unique indexes other than RecId. These may be in the form of a non-RecId primary index

or a replacement key.

Related replacement keys – Each field within the service that is a RecId-based foreign key must relate to a table that specifies a replacement key.

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.

Query and service consistency – Document services are based on an underlying query that defines the data contract used in the service at the time that the service is generated. To be used with the Excel Add-in, the query and service contract must be synchronized. 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 any extension of the schema beyond what is in the underlying query, will not be reflected in the service.

View support – Views may be used within document services to provide an easier-to-use

data model for end users. However, any service that uses a view must have the PrepareForXXXExtended methods implemented to define the correct order of operations on save.

Because of these constraints, the Excel Add-in can be used only with the following document services to update, create, and delete data:

BudgetTransaction

EMSMeterReading

EMSSubstanceFlow

GeneralJournal

ProductionPickingList

ProjectHourJournals

SysImportBusSector

VendGroup

VendRequestSignup

Using the Excel Add-in to import tables

Only tables that meet the following requirements can be imported directly by using the Excel Add-in:

Visible identity – There must be a unique index on the table that does not contain RecId as a

component. This may be either the replacement key or the primary index.

Page 6: DataMigration_AX2012

6 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Valid references – All relations in the relations collection for the table that refer to other tables via RecId must be related to tables that have a replacement key specified.

You can import data into the following Microsoft Dynamics AX 2012 tables by using the Excel Add-in.

Table name Table name

BANKCENTRALBANKPURPOSE LEDGERALLOCATEKEY

BANKGROUP LEDGERALLOCATIONBASISRULE

BANKTRANSACTIONTYPEGROUPHEADER LEDGERALLOCATIONBASISRULESOURCE

BANKTRANSTYPE LEDGERALLOCATIONRULE

BANKTRANSTYPEGROUPDETAILS LEDGERALLOCATIONRULEDESTINATION

CURRENCYLEDGERGAINLOSSACCOUNT LEDGERALLOCATIONRULESOURCE

CUSTBANKACCOUNT LEDGERBALANCECONTROL

CUSTCOLLECTIONLETTERLINE LEDGERIMPORTMODE

CUSTCOLLECTIONLETTERTABLE LEDGERJOURNALTXT

CUSTINTERESTWAIVELIMIT LEDGERSYSTEMACCOUNTS

CUSTLEDGER MAINACCOUNTCATEGORY

CUSTTABLE MAINACCOUNTTEMPLATE

DIRADDRESSBOOK OMOPERATINGUNIT

DIRADDRESSBOOKPARTY PAYMDAY

DIRORGANIZATIONBASE PAYMDAYLINE

DIRPARTYTABLE PAYMSCHEDLINE

DIRPERSON PAYMTERM

DLVTERM PRICEDISCADMNAME

ECORESCATEGORYHIERARCHYROLE PRICEDISCGROUP

ECORESCATEGORYHIERARCHYTRANSLATION PRODUNITTABLE

ECORESSTORAGEDIMENSIONGROUP PROJCATEGORY

EXCHANGERATE REASONTABLE

EXCHANGERATECURRENCYPAIR RETURNACTIONDEFAULTS

EXCHANGERATETYPE RETURNREASONCODEGROUP

FORECASTMODEL ROUTEGROUP

INVENTBATCH ROUTEOPRTABLE

INVENTDIMSETUPGRID SALESQUOTATIONTYPEGROUP

INVENTITEMGROUP SMMCAMPAIGNSELECTION

INVENTLOCATION SMMENCYCLOPEDIAITEMS

INVENTMODELGROUP SMMSALESUNIT

INVENTSITE SMMTMCALLLISTTABLE

JOURNALIZINGDEFINITION STATREPINTERVAL

KANBANQUANTITYPOLICY VENDBANKACCOUNT

KANBANQUANTITYPOLICYDEMANDPERIOD VENDGROUP

LEANPRODUCTIONFLOWMODEL WRKCTRCAPABILITY

Page 7: DataMigration_AX2012

7

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

RapidStart Services

RapidStart Services can be used to populate basic configuration data records in a new environment, and also some master data (customers and vendors). RapidStart Services cannot be used to import transaction data.

Although you can use RapidStart Services to manage customers and vendors, the templates for customers and vendors are quite large. If the volume of customer and vendor data to be imported is small, you may be able to use the customer and vendor templates in RapidStart Services. However, if you have large lists of customers or vendors, you should consider using Application

Integration Framework (AIF).

For more information, see InformationSource.

The following functional areas can be set up by using RapidStart Services:

Applicability Model

Bank Account Management

Base Information (Organization, Ledger Currency)

Customer and Price Discount

General Ledger Setup

Manage Collections

Manage Customers

Manage Fixed Assets

Manage Inventory

Manage Product Categories

Manage Vendors

Organization Information

Process Customer Invoices

Process Customer Payments

Process Vendor Invoices

Process Vendor payments

Purchase Order Management

Purchase Quotation Management

Sales Order Management

Sales Quote Management

Tax

Vendor Price and Discount

At the time of writing, the following are the supported tables in RapidStart Services that correspond to the preceding functional areas.

Table name Table name

AddressCountryRegionGroupBLWI InventModelGroup

AssetAcquisitionMethod InventParameters

AssetActivityCode InventPosting

AssetBonus InventSite

AssetBookTable Ledger

AssetBookTableDerived LedgerAllocateKey

Page 8: DataMigration_AX2012

8 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Table name Table name

AssetCondition LedgerAllocateTrans

AssetDepBookTable LedgerAllocationBasisRule

AssetDepBookTableDerived LedgerAllocationBasisRuleSource

AssetDepreciationProfile LedgerAllocationRule

AssetGroup LedgerAllocationRuleDestination

AssetGroupBookSetup LedgerAllocationRuleSource

AssetGroupDepBookSetup LedgerBalanceControl

AssetGroupDepBookSetupBonus LedgerGainLossAccount

AssetLedger LedgerJournalTxt

AssetLedgerAccounts LedgerParameters

AssetLocation LedgerSystemAccounts

AssetMajorType LineOfBusiness

AssetParameters LogisticsLocation

AssetPropertyGroup MainAccount

AssetTable MainAccountCategory

BankCentralBankPurpose MainAccountTemplate

BankParameters PaymDay

BankTransactionTypeGroupHeader PaymDayLine

BankTransType PaymSched

BankTransTypeGroupDetails PaymSchedLine

CashDisc PaymTerm

CurrencyLedgerGainLossAccount PriceDiscAdmName

CustCollectionLetterLine PriceDiscGroup

CustCollectionLetterTable PriceParameters

CustFormletterParameters PurchParameters

CustGroup PurchRFQParameters

CustInterest ReasonTable

CustInterestFee ReturnActionDefaults

CustInterestVersion ReturnReasonCode

CustInterestVersionDetail ReturnReasonCodeGroup

CustInterestWaiveLimit SalesParameters

CustLedger SalesQuotationTypeGroup

CustLedgerAccounts StatRepInterval

CustParameters StatRepIntervalLine

CustPaymModeTable TaxAuthorityAddress

CustTable TaxData

DirPartyTable TaxExemptCodeTable

DlvMode TaxGroupData

DlvTerm TaxGroupHeading

EcoResCategory TaxItemGroupHeading

Page 9: DataMigration_AX2012

9

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Table name Table name

EcoResCategoryHierarchy TaxLedgerAccountGroup

EcoResCategoryHierarchyRole TaxOnItem

EcoResCategoryHierarchyTranslation TaxParameters

EcoResProductDimensionGroup TaxPeriodHead

EcoResProductDimensionGroupFldSetup TaxReportPeriod

EcoResStorageDimensionGroup TaxTable

EcoResStorageDimensionGroupFldSetup VendExceptionGroup

EcoResTrackingDimensionGroup VendGroup

EcoResTrackingDimensionGroupFldSetup VendLedger

ExchangeRate VendLedgerAccounts

ExchangeRateCurrencyPair VendParameters

ExchangeRateType VendPaymModeTable

InventDimSetupGrid VendTable

InventItemGroup WMSJournalName

InventLocation WMSParameters

AIF, document services, and custom code

AIF provides the capability to integrate Microsoft Dynamics AX with other systems inside and outside the enterprise. AIF provides this capability by enabling the exchange of data through

formatted XML. This formatted XML is referred to as a document, and each document contains data and business logic. Documents are based on a document class and defined by using Microsoft Dynamics AX.

Microsoft Dynamics AX is shipped with many standard document services that support common

business processes. By using the capabilities that AIF provides, you can also customize existing document services or create your own document services. For more information about standard document services and how to create your own document services, see Services and AIF development.

We recommend that you use document services to populate more complex data portions of the data model to ensure data integrity.

Page 10: DataMigration_AX2012

10 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Examples of using AIF to import global address book–related data

In this section, we provide examples that demonstrate how to import customers, vendors, and HCMWorkers, all of which are related to the global address book. The global address book refers to the structures that contain parties and roles, such as customers, vendors, contact people, prospects, leads, and business relations. The global address book uses several core concepts to model real-world relationships. The following figure illustrates where these concepts are used in the data model.

As previously discussed, many of these concepts require that the underlying tables be highly normalized, and therefore make it quite difficult to directly update tables.

Core concept Impact

Table inheritance The party model uses a single party and the corresponding subtypes, such as organizations, teams, departments, and people. Because parties can play many roles, the information for the party, such as the organization, is often split across several tables in the underlying storage layer. These separate tables are managed by the kernel to keep them synchronized.

Date effectivity Date effectivity is used to track the active version of the name of an organization or person as it changes over time. This requires that the name information be stored outside the actual party tables. Again, the kernel ensures the proper closure and creation of new date effective entries, guaranteeing that they do not overlap.

Views and normalization

To ensure data integrity, the model for storing names, city references, address components, and their roles with respect to the party is highly normalized in the database. Views are used to pull the information together.

One-to-many

relationships

The global address book allows an unlimited number of addresses and an unlimited

amount of contact information to be associated with each party.

Because of the complex data model required for the global address book, we recommend that you

import data related to it by using the services layer and APIs.

There are many approaches that can be used to call service layer APIs. In this paper, we describe how to read a flat file, such as a comma-separated value (.csv) file, and call a service by using C# code.

Customer import

In this example, we demonstrate how to import customer data by using the CustomerService

service.

Page 11: DataMigration_AX2012

11

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Expose an inbound port for the customer service

To call the service, you need to expose the service on a new inbound port in Microsoft Dynamics AX.

1. Click System administration > Setup > Services and Application Integration Framework > Inbound ports, and then click New.

2. Give the new port a name, such as Customer Services.

3. Enter a description.

4. Under Service Contract Customizations, click Service Operations. The Select service operations form opens.

5. Select the CustCustomerService operations, move them to the Selected operations

pane, and then click Close.

6. In the Inbound ports form, click Activate.

You can now access the service externally by using the WSDL URI.

Set up the customer service reference in Microsoft Visual Studio

1. Open Microsoft Visual Studio®, and create a new project.

2. Add a new service reference by using the WSDL URI for the customer service from the Inbound ports form.

3. Add a Using statement for the service reference.

You are now ready to start coding against the customer service.

Sample code to import customers from a .csv file by using a Visual Studio

service reference

This section provides a sample that shows the correct order of operations when using the customer service to create a new customer in Microsoft Dynamics AX 2012.

//Index locations of the data columns in the .csv file.

//How you choose to manage the index locations may vary depending on your

implementation and structures used

internal static int NameIndex = 0;

internal static int KnownAsIndex = 1;

Page 12: DataMigration_AX2012

12 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

internal static int PhoneticNameIndex = 2;

internal static int OrganizationNameIndex = 3;

internal static int NameAliasIndex = 4;

internal static int CustGroupIndex = 5;

internal static int SalesGroupIndex = 6;

internal static int DlvModeIndex = 7;

internal static int InvoiceAddressTypeIndex = 8;

internal static int PostalLocationNameIndex = 9;

internal static int PostalstreetIndex = 10;

internal static int PostalBuildingComplimentIndex = 11;

internal static int PostalPOBoxIndex = 12;

internal static int PostalCityIndex = 13;

internal static int PostalStateIndex = 14;

internal static int PostalZipIndex = 15;

internal static int PostalCountryIndex = 16;

internal static int PostalRolesIndex = 17;

internal static int IsPostalPrimaryIndex = 18;

internal static int ContactLocationNameIndex = 19;

internal static int LocatorIndex = 20;

internal static int ContactTypeIndex = 21;

internal static int ContactRolesIndex = 22;

internal static int IsContactPrimaryIndex = 23;

//Create a new Instance of the Customer Service client

CustomerServiceClient custSvcClient = new CustomerServiceClient();

//Read in your .csv file however you want to

//This is just provided as a reference

List<string[]> CustData = ParseCSVFile("C:\\CustomerImport.csv", true);

//Create a customer for each row in the .csv file

foreach (string[] customer in CustData)

{

AxdCustomer axdCustomer = new AxdCustomer();

AxdEntity_DirParty_DirPartyTable dirPartyTable = new

AxdEntity_DirParty_DirPartyTable();

AxdEntity_CustTable custTable = new AxdEntity_CustTable();

AxdEntity_CustTable[] customerList = new AxdEntity_CustTable[1];

EntityKey[] entityKey;

//Create the base organization that the customer will belong

AxdEntity_DirParty_DirOrganization org = new

AxdEntity_DirParty_DirOrganization()

{

KnownAs = customer[KnownAsIndex],

PhoneticName = customer[PhoneticNameIndex],

OrganizationName = new AxdEntity_OrganizationName[1],

NameAlias = customer[NameAliasIndex],

Name = customer[NameIndex]

};

// Create the Organization name for the Customer

AxdEntity_OrganizationName orgName = new AxdEntity_OrganizationName()

{

Name = customer[OrganizationNameIndex]

};

Page 13: DataMigration_AX2012

13

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

//Assign organization name to the base organization.

org.OrganizationName[0] = orgName;

//Add an address to the org. You can add a loop and add as many address and

types you want to here

AxdEntity_DirPartyPostalAddressView[] postalAddView = new

AxdEntity_DirPartyPostalAddressView[1];

postalAddView[0] = new AxdEntity_DirPartyPostalAddressView()

{

LocationName = customer[PostalLocationNameIndex],

BuildingCompliment = customer[PostalBuildingComplimentIndex],

City = customer[PostalCityIndex],

State = customer.[PostalStateIndex],

ZipCode = customer[PostalZipIndex],

Street = customer[PostalstreetIndex],

CountryRegionId = customer[PostalCountryIndex],

//Valid Values come from the Typed column logisticsLocationRole where

//IsPostalAddress = true

Roles = customer[PostalRolesIndex],

IsPrimary =

(AxdExtType_LogisticsIsPrimaryAddress)Enum.Parse(typeof(AxdExtType_Logi

sticsIsPrimaryAddress),customer[IsPostalPrimaryIndex])

};

//Add the party Address to the Organization

org.DirPartyPostalAddressView = postalAddView;

//Add a contact to the organization. You can add a loop and add as many address

//and types you want to here

AxdEntity_DirPartyContactInfoView[] contactList = new

AxdEntity_DirPartyContactInfoView[1];

contactList[0] = new AxdEntity_DirPartyContactInfoView()

{

LocationName = customer[ContactLocationNameIndex],

//Value of locator will vary by type.

Locator = customer[LocatorIndex],

IsPrimarySpecified = true,

IsPrimary = (AxdEnum_NoYes)Enum.Parse(typeof(AxdEnum_NoYes),

customer[IsContactPrimaryIndex]),

TypeSpecified = true,

Type =

(AxdEnum_LogisticsElectronicAddressMethodType)Enum.Parse(typeof(AxdEnum

_LogisticsElectronicAddressMethodType), customer[ContactTypeIndex]),

//Valid Values come from the Typed column logisticsLocationRole where

//IsContactInfo = true

Roles = customer[ContactRolesIndex]

};

//Add the contacts to the organization

org.DirPartyContactInfoView = contactList;

//Set the customer specific information on the CustTable

custTable.CustGroup = customer[CustGroupIndex];

custTable.InvoiceAddress =

(AxdExtType_CustInvoiceAddress)Enum.Parse(typeof(AxdExtType_CustInvoiceAddress)

,customer[InvoiceAddressTypeIndex]);

Page 14: DataMigration_AX2012

14 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

custTable.InvoiceAddressSpecified = true;

custTable.DlvMode = customer[DlvModeIndex];

custTable.SalesGroup = customer[SalesGroupIndex];

//Assign the organization to the customer

custTable.DirParty = new AxdEntity_DirParty_DirPartyTable[1];

custTable.DirParty[0] = org;

//Add the specific customer to the list

customerList[0] = custTable;

axdCustomer.CustTable = customerList;

//Set the header fields

axdCustomer.DocPurpose = AxdEnum_XMLDocPurpose.Original;

axdCustomer.DocPurposeSpecified = true;

//Create the customer

entityKey = custSvcClient.create(null, axdCustomer);

}

}

//Simple .csv parser without any robust error handling. Please implement your

//own logic to parse your csv file or use existing parsing libraries.

//This code is provided only as a sample.

public static List<string[]> ParseCSVFile(string path, Boolean hasHeaders)

{

List<string[]> CSVRows = new List<string[]>();

int rowNumber = 0;

using (StreamReader inputFile = new StreamReader(path))

{

string line;

string[] columns;

while ((line = inputFile.ReadLine()) != null)

{

columns = line.Split(',');

if (hasHeaders != true || rowNumber != 0)

{

CSVRows.Add(columns);

}

rowNumber++;

}

}

return CSVRows;

}

Sample .csv file to use for import

The preceding sample assumes that a .csv file with the following headers exists. The CustGroup, SalesGroup, and other reference values come from a system where the reference data was already set up via RapidStart Services.

Page 15: DataMigration_AX2012

15

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Header field Values row 1 Values row 2

Name Customer One Customer Two

KnownAs cust1 cust2

PhoneticName Customer1 Customer2

OrganizationName Customer One Customer Two

NameAlias cust1 cust2

CustGroup 10 10

SalesGroup 10 20

DlvMode 1 10

InvoiceAddressType InvoiceAccount InvoiceAccount

PostalLocationName Primary Primary

Postalstreet 11111 Sample Lane 22222 Sample Lane

PostalBuildingCompliment Building 1

PostalPOBox

PostalCity Redmond Redmond

PostalState WA WA

PostalZip 98052 98052

PostalCountry USA USA

PostalRoles Delivery;Invoice;Business Delivery;Invoice;Business

IsPostalPrimary Yes Yes

ContactLocationName Primary Phone Primary Phone

Locator 111-222-333-4444 111-222-333-4444

ContactType Phone Phone

ContactRoles Business Business

IsContactPrimary Yes Yes

Vendor import

In this example, we demonstrate how to import vendor data by using the vendVendTableService service.

Expose an inbound port for the vendor service

To call the service, you need to expose the service on a new inbound port in Microsoft Dynamics AX.

1. Click System administration >Setup > Services and Application Integration Framework > Inbound ports, and then click New.

2. Give the new port a name, such as Vendor Services.

3. Enter a description.

4. Under Service Contract Customizations, click Service Operations. The Select service operations form opens.

5. Select the vendVendTableService operations, move them to the Selected operations pane, and then click Close.

6. In the Inbound ports form, click Activate.

You can now access the service externally by using the WSDL URI.

Page 16: DataMigration_AX2012

16 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Set up the vendor service reference in Visual Studio

1. Open Visual Studio, and create a new project.

2. Add a new service reference by using the WSDL URI for the vendor service from the

Inbound ports form.

3. Add a Using statement for the service reference.

You are now ready to start coding against the vendor service.

Sample code to import a vendor from a .csv file by using a Visual Studio

service reference

The sample code for a vendor import follows the same pattern as the sample for a customer import, except that the axdCustomer and CustTable objects in the code should be replaced with the AxdVendor and VendTable objects.

Modify the customer or vendor import sample to bind to DirPerson instead of

DirOrganization

If you intend to bind the customer or vendor to a person rather than an organization, the code needs to be modified to create a DirPerson rather than a DirOrganization. This section provides a sample that shows how to create a DirOrganization.

The rest of the code functions the same for address and contacts, but you should attach the address to the DirPerson rather than the DirOrganization.

AxdEntity_DirParty_DirPerson person = new AxdEntity_DirParty_DirPerson()

{

KnownAs = "KnownAs",

NameAlias = "NameAlias",

Name = "NameAlias",

NameSequence = "NameSequence",

};

// Create and assign the person name

person.PersonName = new AxdEntity_PersonName[1];

AxdEntity_PersonName personName = new AxdEntity_PersonName()

{

FirstName = "FirstName",

MiddleName = "MiddleName",

LastName = "LastName"

};

person.PersonName[0] = personName;

HCMWorker (employee or worker) import

In Cumulative Update 2 for Microsoft Dynamics AX 2012, a new HCMWorkerImport service was introduced. This service can be used to import employees or workers into the system. When you use this service, your code will create new HCMWorker, HCMEmployment, and HCMEmploymentDetail objects, and will use dirPartyAddressView and dirPartyContactView,

similar to the customer import sample code.

Expose an inbound port for the HCMWorker service

To call the service, you need to expose the service on a new inbound port in Microsoft Dynamics AX.

1. Click System administration > Setup > Services and Application Integration Framework > Inbound ports, and then click New.

2. Give the new port a name, such as HCMWorkerImport Services.

3. Enter a description.

4. Under Service Contract Customizations, click Service Operations. The Select service operations form opens.

Page 17: DataMigration_AX2012

17

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

5. Select the HCMWorkerImportService operations, move them to the Selected operations pane, and then click Close.

6. In the Inbound ports form, click Activate.

You can now access the service externally by using the WSDL URI.

Set up the HCMWorker service reference in Visual Studio

1. Open Visual Studio, and create a new project.

2. Add a new service reference by using the WSDL URI for the HCMWorker service from the Inbound ports form.

3. Add a Using statement for the service reference.

You are now ready to start coding against the HCMWorker service.

Sample code to import HCMWorkers

This section provides a sample that shows the correct order of operations when using the HCMWorkerImport service to create an employee in Microsoft Dynamics AX 2012. Unlike previous samples, this sample does not include code for reading of a .csv file. However, you can modify your own code to set the fields based on the contents of a .csv CSV file.

HcmWorkerImportServiceClient hcmSvcClient = new HcmWorkerImportServiceClient();

AxdHcmWorkerImport workerDocument = new AxdHcmWorkerImport();

AxdEntity_HcmWorker worker = new AxdEntity_HcmWorker();

AxdEntity_HcmWorker[] workerList = new AxdEntity_HcmWorker[1];

AxdEntity_HcmWorkerTitle workerTitle = new AxdEntity_HcmWorkerTitle();

AxdEntity_DirPerson_DirPerson person = new AxdEntity_DirPerson_DirPerson();

AxdEntity_DirPersonName personName = new AxdEntity_DirPersonName();

AxdEntity_HcmPersonDetails personDetails = new AxdEntity_HcmPersonDetails();

AxdEntity_HcmPersonPrivateDetails personPrivateDetails = new

AxdEntity_HcmPersonPrivateDetails();

AxdEntity_HcmEmployment employment = new AxdEntity_HcmEmployment();

AxdEntity_HcmEmploymentDetail employmentDetail = new

AxdEntity_HcmEmploymentDetail();

//The Address and Contact code is the same as in the Customer and Vendor scenarios

//Adding addresses and contacts is optional

//Create an address for the person. You can add a loop and add as many address

//and types you want to here

AxdEntity_DirPartyPostalAddressView[] postalAddView = new

AxdEntity_DirPartyPostalAddressView[1];

postalAddView[0] = new AxdEntity_DirPartyPostalAddressView()

{

LocationName = "EmployeeAddr",

BuildingCompliment = "EmplBuildCompliment",

City = "Redmond",

State = "WA",

ZipCode = "98052",

Street = "12345 Import Lane",

CountryRegionId = "USA",

//Valid Values come from the Typed column logisticsLocationRole where

//IsPostalAddress = true

Roles = "Home",

IsPrimary = AxdExtType_LogisticsIsPrimaryAddress.Yes

};

//Add the party Address to the person

person.DirPartyPostalAddressView = postalAddView;

Page 18: DataMigration_AX2012

18 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

//Create a contact for the person. You can add a loop and add as many address and

//types you want to here

AxdEntity_DirPartyContactInfoView[] contactList = new

AxdEntity_DirPartyContactInfoView[1];

contactList[0] = new AxdEntity_DirPartyContactInfoView()

{

LocationName = "Employee email",

//Value of locator will vary by type.

Locator = "[email protected]",

IsPrimarySpecified = true,

IsPrimary = AxdEnum_NoYes.Yes,

TypeSpecified = true,

Type = AxdEnum_LogisticsElectronicAddressMethodType.Email,

//Valid Values come from the Type column in logisticsLocationRole table where

//IsContactInfo = true

Roles = "Business"

};

//Add the contacts to the person

person.DirPartyContactInfoView = contactList;

//Assign property values to the personName object

personName.LastName = "SampleLast1";

personName.FirstName = "SampleFirst1";

personName.MiddleName = "SampleMiddle1";

//Assign PersonName to DirPersonName

person.DirPersonName = personName;

//Assign person deatils properties

personDetails.MaritalStatus = AxdEnum_HcmPersonMaritalStatus.Married;

personDetails.MaritalStatusSpecified = true;

//Assign person Details to the person

person.HcmPersonDetails = personDetails;

personPrivateDetails.BirthDate = new DateTime(1983, 2, 18);

personPrivateDetails.BirthDateSpecified = true;

personPrivateDetails.Gender = AxdEnum_HcmPersonGender.Male;

personPrivateDetails.GenderSpecified = true;

//Assign person private Details to the person

person.HcmPersonPrivateDetails = personPrivateDetails;

//Assign the person to the worker

worker.DirPerson = person;

//Create the employment array for the worker

AxdEntity_HcmEmployment[] employmentList = new AxdEntity_HcmEmployment[1];

//Set the employment ValidTo and ValidFrom Fields

AxdExtType_HcmEmploymentValidFrom employmentValidFrom = new

AxdExtType_HcmEmploymentValidFrom();

employmentValidFrom.Value = DateTime.UtcNow.AddYears(-5);

Page 19: DataMigration_AX2012

19

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

AxdExtType_HcmEmploymentValidTo employmentValidTo = new

AxdExtType_HcmEmploymentValidTo();

employmentValidTo.Value = DateTime.UtcNow.AddYears(10);

//Set the properties to the employment object

employment.ValidFrom = employmentValidFrom;

employment.ValidTo = employmentValidTo;

employment.LegalEntity = "CEU";

employment.EmploymentType = AxdEnum_HcmEmploymentType.Employee;

//Create an employment Detail object and set the start date

AxdExtType_HcmEmploymentStartDateTime employmentStartDate = new

AxdExtType_HcmEmploymentStartDateTime();

employmentStartDate.Value = DateTime.UtcNow.AddDays(7);

employmentDetail.WorkerStartDate = employmentStartDate;

//Assign the Detail to the employment object

employment.HcmEmploymentDetail = employmentDetail;

//Assign the employment object to the employment list

employmentList[0] = employment;

worker.HcmEmployment = employmentList;

//Assign values to the worker title object

AxdExtType_HcmEmploymentSeniorityDateTime seniorityDateEDT = new

AxdExtType_HcmEmploymentSeniorityDateTime();

seniorityDateEDT.Value = DateTime.UtcNow.AddYears(1);

workerTitle.SeniorityDate = seniorityDateEDT;

workerTitle.OfficeLocation = "Room101";

//Assign worker Title to Worker

worker.HcmWorkerTitle = workerTitle;

//Set the Personnel number. This must be unique for each worker record.

worker.PersonnelNumber = "ImportSVCNum1";

//Create the worker element in the document

workerDocument.HcmWorker = new AxdEntity_HcmWorker[1];

//assign the worker to the document

workerDocument.HcmWorker[0] = worker;

workerDocument.DocPurpose = AxdEnum_XMLDocPurpose.Original;

workerDocument.DocPurposeSpecified = true;

//Call the create on the service with the worker document

EntityKey[] ek = hcmSvcClient.create(null, workerDocument);

Product-item data management services

The following services have been created or modified to enable manipulation of product-item data.

Service Purpose

EcoResProductService Create products (all three types). The service can also be used to retrieve data that has already been created.

Page 20: DataMigration_AX2012

20 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Service Purpose

EcoResProductMasterDimValueService Specify values of product dimensions for a product master. These

values become available for the creation of product variants. The service can also be used to retrieve data that has already been created.

ItemService Release distinct products and product masters. The service can also be used to retrieve data that has already been created.

InventDimCombinationService Release product variants. The service can also be used to retrieve data that has already been created.

All types of products are created by using the EcoResProductService service. However, the methods to create a distinct product, a product master, and a product variant are different, so each method is described separately.

Exposing an inbound port for ProductItem import

Product-item services must be enabled on an AIF inbound port before they can be used. All services can be enabled on one port, or several ports can be used.

To call the service, you need to expose the service on a new inbound port in Microsoft Dynamics AX.

1. Click System administration > Setup > Services and Application Integration Framework > Inbound ports, and then click New.

2. Give the new port a name, such as ProductItem Services.

3. Enter a description.

4. Under Service Contract Customizations, click Service Operations. The Select service operations form opens.

Page 21: DataMigration_AX2012

21

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

5. Select the Product and Item operations, move them to the Selected operations pane, and then click Close.

6. In the Inbound ports form, click Activate.

You can now access the service externally by using the WSDL URI.

Set up the ProductItem service reference in Visual Studio

1. Open Visual Studio, and create a new project.

2. Add a new service reference by using the WSDL URI for the ProductItem service from the Inbound ports form.

3. Add a Using statement for the service reference.

You are now ready to start coding against the ProductItem service.

Create a distinct product

To create a distinct product, use the EcoResProductService.create operation.

The following code creates a distinct product in Microsoft Dynamics AX.

static void createDistinctProduct()

{

AxdEntity_Product_EcoResDistinctProduct distinctProduct = new

AxdEntity_Product_EcoResDistinctProduct()

{

DisplayProductNumber = "Bulb60W",

ProductType = AxdEnum_EcoResProductType.Item,

SearchName = "Bulb60W"

};

distinctProduct.Translation = new AxdEntity_Translation[1];

distinctProduct.Translation[0] = new AxdEntity_Translation()

Page 22: DataMigration_AX2012

22 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

{

LanguageId = "en-us", Name = "Transparent Bulb 60W"

};

distinctProduct.Identifier = new AxdEntity_Identifier[1];

distinctProduct.Identifier[0] = new AxdEntity_Identifier()

{

ProductNumber = "Bulb60W"

};

distinctProduct.StorageDimGroup = new AxdEntity_StorageDimGroup[1];

distinctProduct.StorageDimGroup[0] = new AxdEntity_StorageDimGroup()

{

Product = "Bulb60W", StorageDimensionGroup = "Std-Dim"

};

distinctProduct.TrackingDimGroup = new AxdEntity_TrackingDimGroup[1];

distinctProduct.TrackingDimGroup[0] = new AxdEntity_TrackingDimGroup()

{

Product = "Bulb60W", TrackingDimensionGroup = "Std-Dim"

};

AxdEcoResProduct axdProduct = new AxdEcoResProduct()

{

Product = new AxdEntity_Product_EcoResProduct[1] { distinctProduct }

};

CallContext ctx = new CallContext();

EcoResProductServiceClient service = new EcoResProductServiceClient();

try

{

service.create(ctx, axdProduct);

}

catch (Exception e)

{

System.Console.WriteLine(e.Message);

System.Console.ReadKey();

}

}

The create operation accepts an array of products, so it is possible to create multiple products in one call to the service.

Create a product master and a related product variant

To create a product master, use the EcoResProductService.create operation. Then use the EcoResProductMasterDimValue.create operation to associate product dimension values

with the product master. Finally, use the EcoResProductService.create operation again, this time to create a product variant.

The code to create a product master is similar to the code that creates a distinct product. The primary difference is the code that associates the product master with a product dimension group (Size-Dim in the following example).

static void createMaster()

{

//master definition

AxdEntity_Product_EcoResProductMaster productMaster = new

AxdEntity_Product_EcoResProductMaster()

{

DisplayProductNumber = "RunningShoe",

ProductType = AxdEnum_EcoResProductType.Item,

SearchName = "RunningShoe",

};

productMaster.Translation = new AxdEntity_Translation[1];

productMaster.Translation[0] = new AxdEntity_Translation()

{

LanguageId = "en-us", Name = "Comfortable running shoe"

};

productMaster.Identifier = new AxdEntity_Identifier[1];

productMaster.Identifier[0] = new AxdEntity_Identifier()

{

ProductNumber = "RunningShoe"

};

productMaster.ProductDimGroup = new AxdEntity_ProductDimGroup[1];

productMaster.ProductDimGroup[0] = new AxdEntity_ProductDimGroup()

Page 23: DataMigration_AX2012

23

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

{

Product = "RunningShoe", ProductDimensionGroup = "Size-Dim"

};

productMaster.VariantConfigurationTechnology =

AxdEnum_EcoResVariantConfigurationTechnologyType.PredefinedVariants;

AxdEcoResProduct axdProduct = new AxdEcoResProduct()

{

Product = new AxdEntity_Product_EcoResProduct[1] { productMaster }

};

CallContext ctx = new CallContext();

EcoResProductServiceClient productService = new EcoResProductServiceClient();

try

{

productService.create(ctx, axdProduct);

}

catch (Exception e)

{

System.Console.WriteLine(e.Message);

System.Console.ReadKey();

}

}

When the product master is created, associate two size dimension values with the product master (sizes L and M).

static void createMasterDimensions()

{

//master dimensions definition (two sizes, L and M)

AxdEntity_MasterDim_EcoResProductMasterSize sizeDimensionL = new

AxdEntity_MasterDim_EcoResProductMasterSize()

{

SizeProductMaster = "RunningShoe",

Size = "L",

EcoResSize = new AxdEntity_EcoResSize[1]

{

new AxdEntity_EcoResSize() { Name = "L" }

}

};

AxdEntity_MasterDim_EcoResProductMasterSize sizeDimensionM = new

AxdEntity_MasterDim_EcoResProductMasterSize()

{

SizeProductMaster = "RunningShoe",

Size = "M",

EcoResSize = new AxdEntity_EcoResSize[1]

{

new AxdEntity_EcoResSize() { Name = "M" }

}

};

AxdEcoResProductMasterDimValue axdDimValue = new AxdEcoResProductMasterDimValue()

{

MasterDim = new AxdEntity_MasterDim_EcoResProductMasterDimensionValue[2] {

sizeDimensionL, sizeDimensionM }

};

CallContext ctx = new CallContext();

EcoResProductMasterDimValueServiceClient masterDimensionService = new

EcoResProductMasterDimValueServiceClient();

try

{

masterDimensionService.create(ctx, axdDimValue);

}

catch (Exception e)

{

System.Console.WriteLine(e.Message);

System.Console.ReadKey();

}

}

Create a product variant with the size L for the product master.

One thing that may not be apparent from the sample is the value that is required for the ProductDimensionAttribute field of the

Page 24: DataMigration_AX2012

24 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

AxdEntity_VariantDimValue_EcoResProductVariantConfiguration, AxdEntity_VariantDimValue_EcoResProductVariantSize, and AxdEntity_VariantDimValue_EcoResProductVariant entities. The value must correspond to the IDs of the EcoResConfiguration, the EcoResSize, and the EcoResColor tables,

respectively.

static void createVariant()

{

//product variant definition

AxdEntity_Product_EcoResDistinctProductVariant productVariant = new

AxdEntity_Product_EcoResDistinctProductVariant()

{

DisplayProductNumber = "RunningShoeL",

ProductType = AxdEnum_EcoResProductType.Item,

SearchName = "RunningShoeL",

ProductMaster = "RunningShoe"

};

productVariant.Translation = new AxdEntity_Translation[1];

productVariant.Translation[0] = new AxdEntity_Translation()

{

LanguageId = "en-us", Name = "Comfortable running shoe L size"

};

productVariant.VariantDimValue = new

AxdEntity_VariantDimValue_EcoResProductVariantDimensionValue[1];

productVariant.VariantDimValue[0] = new

AxdEntity_VariantDimValue_EcoResProductVariantSize()

{

DistinctProductVariant = "RunningShoeL",

ProductDimensionAttribute = 3173,//The ID of the EcoResSize table

Size = "L",

EcoResSize = new AxdEntity_EcoResSize1[1]

{

new AxdEntity_EcoResSize1() { Name = "L" }

}

};

AxdEcoResProduct axdProduct = new AxdEcoResProduct()

{

Product = new AxdEntity_Product_EcoResProduct[1] { productVariant }

};

CallContext ctx = new CallContext();

EcoResProductServiceClient productService = new EcoResProductServiceClient();

try

{

productService.create(ctx, axdProduct);

}

catch (Exception e)

{

System.Console.WriteLine(e.Message);

System.Console.ReadKey();

}

}

Release products

A product must be released to a company before it can be used in that company. The ItemService and InventDimCombinationService services serve this purpose. The former can be used to release distinct products and product masters. The latter can be used to release product variants. A product master must be released before any of its product variants can be released.

Release a distinct product or a product master

The only information required to release a product to a company is the ID of the product and the ID by which it will be represented in the company (ItemId). It is possible to add information to the ItemService service. In the following example, information about the units used for storage, purchasing, and selling is provided.

private static void releaseProduct()

{

AxdEntity_InventTable inventTable = new AxdEntity_InventTable()

Page 25: DataMigration_AX2012

25

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

{

ItemId = "Bulb60W",

Product = "Bulb60W",

Invent = new AxdEntity_Invent[1]

{

new AxdEntity_Invent()

{

ItemId = "Bulb60W", UnitId = "Box"

}

},

Purch = new AxdEntity_Purch[1]

{

new AxdEntity_Purch()

{

ItemId = "Bulb60W", UnitId = "Box"

}

},

Sales = new AxdEntity_Sales[1]

{

new AxdEntity_Sales()

{

ItemId = "Bulb60W", UnitId = "Pcs"

}

}

};

AxdItem item = new AxdItem()

{

InventTable = new AxdEntity_InventTable[1] { inventTable }

};

CallContext ctx = new CallContext() { Company = "DMO" };

ItemServiceClient itemService = new ItemServiceClient();

try

{

itemService.create(ctx, item);

}

catch (Exception e)

{

System.Console.WriteLine(e.Message);

System.Console.ReadKey();

}

}

Release a product variant

A product variant can be released after a related product master has been released. When you release a product variant to a company, the product variant can be identified in two different ways:

Use the product number of the product variant.

Use the ID of the associated product master in the company (ItemId) and the

InventDim structure, with the relevant fields set to the dimension values for the variant

(the ItemId/InventDim approach).

For details, see the following examples.

Use the product number of the product variant (DistinctProductVariant)

private static void releaseProductVariants()

{

AxdEntity_InventDimCombination releasedVariant = new AxdEntity_InventDimCombination()

{

DistinctProductVariant = "RunningShoeL",

ItemId = ""

};

AxdInventDimCombination inventDimCombination = new AxdInventDimCombination()

{

InventDimCombination = new AxdEntity_InventDimCombination[1] { releasedVariantL }

};

CallContext ctx = new CallContext() { Company = "DMO" };

Page 26: DataMigration_AX2012

26 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

InventDimCombinationServiceClient inventDimCombinationService = new

InventDimCombinationServiceClient();

try

{

inventDimCombinationService.create(ctx, inventDimCombination);

}

catch (Exception e)

{

System.Console.WriteLine(e.Message);

System.Console.ReadKey();

}

}

Use the ItemId/InventDim approach

private static void releaseProductVariants()

{

AxdEntity_InventDimCombination releasedVariant = new AxdEntity_InventDimCombination()

{

DistinctProductVariant = "",

ItemId = "RunningShoe",

InventDim = new AxdEntity_InventDim[1]

{

new AxdEntity_InventDim()

{

InventSizeId = "M"

}

}

};

AxdInventDimCombination inventDimCombination = new AxdInventDimCombination()

{

InventDimCombination = new AxdEntity_InventDimCombination[2] { releasedVariantM }

};

CallContext ctx = new CallContext() { Company = "DMO" };

InventDimCombinationServiceClient inventDimCombinationService = new

InventDimCombinationServiceClient();

try

{

inventDimCombinationService.create(ctx, inventDimCombination);

}

catch (Exception e)

{

System.Console.WriteLine(e.Message);

System.Console.ReadKey();

}

}

Recommended import methods for specific tables and entities

The following table lists the supported and recommended import methods for common tables and entities.

Entity or table name Supported import methods

Recommended import method

Entity: Chart of Accounts AIF, RapidStart, Excel Excel

Entity: Contact and Addresses AIF AIF

Entity: Customer and Addresses AIF, RapidStart AIF

Entity: Employees AIF, RapidStart AIF

Entity: Items (Product, product maters) AIF, RapidStart AIF

Entity: Vendors and Addresses AIF, RapidStart AIF

BankCentralBankPurpose Excel, RapidStart Excel

BankGroup Excel Excel

Page 27: DataMigration_AX2012

27

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Entity or table name Supported import methods

Recommended import method

BankTransactionTypeGroupHeader Excel, RapidStart Excel

BankTransType Excel, RapidStart Excel

BankTransTypeGroupDetails Excel, RapidStart Excel

CurrencyLedgerGainLossAccount Excel, RapidStart Excel

CUSTBANKACCOUNT Excel Excel

CustCollectionLetterLine Excel, RapidStart Excel

CustCollectionLetterTable Excel, RapidStart Excel

CustGroup Excel, RapidStart Excel

CustInterestWaiveLimit Excel, RapidStart Excel

CustLedger Excel, RapidStart Excel

CustLedgerAccounts Excel, RapidStart Excel

CustTable Excel, RapidStart Excel

DLVTerm Excel, RapidStart Excel

ECORESCATEGORYHIERARCHYROLE Excel Excel

ECORESCATEGORYHIERARCHYTRANSLATION Excel, RapidStart Excel

EcoResStorageDimensionGroup Excel, RapidStart Excel

ExchangeRate Excel, RapidStart Excel

ExchangeRateCurrencyPair Excel, RapidStart Excel

ExchangeRateType Excel, RapidStart Excel

FORECASTMODEL Excel Excel

INVENTBATCH Excel Excel

InventDimSetupGrid Excel, RapidStart Excel

InventItemGroup Excel, RapidStart Excel

InventLocation Excel, RapidStart Excel

InventModelGroup Excel Excel

InventSite Excel, RapidStart Excel

JournalizingDefinition Excel, RapidStart Excel

KANBANQUANTITYPOLICY Excel Excel

KANBANQUANTITYPOLICYDEMANDPERIOD Excel Excel

LEANPRODUCTIONFLOWMODEL Excel Excel

LedgerAllocateKey Excel, RapidStart Excel

LedgerAllocationBasisRule Excel Excel

LedgerAllocationBasisRuleSource Excel Excel

LedgerAllocationRule Excel Excel

LedgerAllocationRuleDestination Excel Excel

LedgerAllocationRuleSource Excel Excel

LEDGERBALANCECONTROL Excel Excel

LedgerGainLossAccount Excel Excel

LedgerImportMode Excel Excel

LedgerJournalTxt Excel, RapidStart Excel

Page 28: DataMigration_AX2012

28 DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Entity or table name Supported import methods

Recommended import method

LedgerSystemAccounts Excel, RapidStart Excel

MainAccount Excel, RapidStart, AIF Excel

MainAccountCategory Excel, RapidStart Excel

MainAccountTemplate Excel, RapidStart Excel

OMOPERATINGUNIT Excel Excel

PaymDay Excel, RapidStart Excel

PAYMDAYLINE Excel Excel

PaymSchedLine Excel, RapidStart Excel

PaymTerm Excel, RapidStart Excel

PriceDiscAdmName Excel, RapidStart Excel

PriceDiscGroup Excel, RapidStart Excel

PRODUNITTABLE Excel Excel

PROJCATEGORY Excel Excel

ReasonTable Excel, RapidStart Excel

ReturnActionDefaults Excel, RapidStart Excel

ReturnReasonCodeGroup Excel, RapidStart Excel

ROUTEGROUP Excel Excel

ROUTEOPRTABLE Excel Excel

SalesQuotationTypeGroup Excel, RapidStart Excel

SMMCAMPAIGNSELECTION Excel Excel

SMMENCYCLOPEDIAITEMS Excel Excel

SMMSALESUNIT Excel Excel

SMMTMCALLLISTTABLE Excel Excel

StatRepInterval Excel, RapidStart Excel

VendBankAccount Excel, RapidStart Excel

VendGroup Excel, RapidStart Excel

WRKCTRCAPABILITY Excel Excel

Performance considerations

As the volume of data being imported increases, the use of a single-threaded service may not meet your performance needs. Each record in a synchronous service call is processed serially and

does not take advantage of parallelism. The services stack has built-in support to run requests in parallel. However, you must use the Fie System Adapter rather than NetTcp. To do this, you will need to create the requests as .xml files, and leverage the BatchId and CoversationID in the .xml file. This process is documented in the MSDN topic Processing batched messages in AIF.

Page 29: DataMigration_AX2012

29

DATA MIGRATION FOR MICROSOFT DYNAMICS AX 2012

Microsoft Dynamics is a line of integrated, adaptable business management solutions that enables you and your people to make business decisions with greater confidence. Microsoft Dynamics works like and with familiar Microsoft software, automating and streamlining financial, customer relationship and supply chain processes in a way that helps you drive business success.

U.S. and Canada Toll Free 1-888-477-7989

Worldwide +1-701-281-6500

www.microsoft.com/dynamics

This document is provided “as-is.” Information and views expressed in this document, including URL and other Internet Web site

references, may change without notice. You bear the risk of using it.

Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or

should be inferred.

This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and

use this document for your internal, reference purposes. You may modify this document for your internal, reference purposes.

© 2012 Microsoft Corporation. All rights reserved.