Microsoft Dynamics AX Support

This blog contains posts by the Microsoft Dynamics AX Support teams Worldwide

Importing Products into AX 2012

Importing Products into AX 2012

Rate This
  • Comments 4

We have had several questions on how to import items/products into AX 2012.  There is a blog the development team created around calling the services needed to import those items.  In the example below we used the same code the development team used and re-wrote it so that it might look more familiar to you.  That is to say, more like how you might call other web services.  Hope this helps!

 //Example take from article

            EcoResProductServiceClient service = new EcoResProductServiceClient();
            CallContext ctx = new CallContext();
            ctx.Company = "ceu";

            AxdEcoResProduct axdProduct = new AxdEcoResProduct();
            //first, create a distinct product
            AxdEntity_Product_EcoResDistinctProduct distinctProduct = new AxdEntity_Product_EcoResDistinctProduct();
            distinctProduct.DisplayProductNumber = "Bulb60W";
            distinctProduct.ProductType = AxdEnum_EcoResProductType.Item;
            distinctProduct.SearchName = "Bulb60W";
            AxdEntity_Translation tran = new AxdEntity_Translation();
            tran.LanguageId = "en-us";
            tran.Name = "Transparent Bulb 60W";
            distinctProduct.Translation = new AxdEntity_Translation[1] { tran };
            AxdEntity_Identifier ident = new AxdEntity_Identifier();
            ident.ProductNumber = "Bulb60W";
            distinctProduct.Identifier = new AxdEntity_Identifier[1] {ident};

            AxdEntity_StorageDimGroup storage = new AxdEntity_StorageDimGroup();
            storage.Product = "Bulb60W";
            storage.StorageDimensionGroup = "PG_30";
            distinctProduct.StorageDimGroup = new AxdEntity_StorageDimGroup[1] {storage};
            AxdEntity_TrackingDimGroup tracking = new AxdEntity_TrackingDimGroup();
            tracking.Product = "Bulb60W";
            tracking.TrackingDimensionGroup = "PG_30";
            distinctProduct.TrackingDimGroup = new AxdEntity_TrackingDimGroup[1] {tracking};

            axdProduct.Product = new AxdEntity_Product_EcoResProduct[1] { distinctProduct };

                service.create(ctx, axdProduct);
            catch (Exception e)


            //Then, release the product by calling the ItemService
            ItemServiceClient itemService = new ItemServiceClient();
            CallContext ctx2 = new CallContext();
            ctx2.Company = "ceu";

            AxdItem item = new AxdItem();

            AxdEntity_InventTable inventTable = new AxdEntity_InventTable();
            inventTable.ItemId = "Bulb60W";
            inventTable.Product = "Bulb60W";
            AxdEntity_Invent inventItem = new AxdEntity_Invent();
            inventItem.ItemId = "Bulb60W";
            inventItem.UnitId = "Box";
            inventTable.Invent = new AxdEntity_Invent[1] {inventItem};
            AxdEntity_Purch purchitem = new AxdEntity_Purch();
            purchitem.ItemId = "Bulb60W";
            purchitem.UnitId = "Box";
            inventTable.Purch = new AxdEntity_Purch[1] {purchitem};
            AxdEntity_Sales salesitem = new AxdEntity_Sales();
            salesitem.ItemId = "Bulb60W";
            salesitem.UnitId = "Pcs";
            inventTable.Sales = new AxdEntity_Sales[1] {salesitem};

            item.InventTable = new AxdEntity_InventTable[1] { inventTable };
                itemService.create(ctx2, item);
            catch (Exception e)


Leave a Comment
  • Please add 1 and 1 and type the answer here:
  • Post
  • I cannot find any resources how to do my data migration ..

    I have products with variants I completed all work with Excel Addin " Was not Easy Though " now I am stuck with how to define configration size and color and release variants  ..

  • Hello,

    To define dimensions on your products first you should import your product master or your distinct product using either the EcoResProductService.  Assign a dimension group to the product master you import.  Then use the EcoResProductMasterDimValueService to assign dimension values to the product.  So something like this for the product master of 3004:

    EcoResProductMasterDimValueServiceClient client = new EcoResProductMasterDimValueServiceClient();

               CallContext context = new CallContext();

               context.Company = "ceu";

               AxdEcoResProductMasterDimValue dimValue = new AxdEcoResProductMasterDimValue();

               AxdEntity_MasterDim_EcoResProductMasterSize size = new AxdEntity_MasterDim_EcoResProductMasterSize();

               size.SizeProductMaster = "3004";

               size.Size = "1.66";

               size.Description = "My added size";

               AxdEntity_EcoResSize ecoResSize = new AxdEntity_EcoResSize();

               ecoResSize.Name = "1.66";

               size.EcoResSize = new AxdEntity_EcoResSize[1] { ecoResSize };

    AxdEntity_MasterDim_EcoResProductMasterSize size2 = new AxdEntity_MasterDim_EcoResProductMasterSize();

               size2.SizeProductMaster = "3004";

               size2.Size = "1.77";

               size2.Description = "My added size2";

               AxdEntity_EcoResSize ecoResSize2 = new AxdEntity_EcoResSize();

               ecoResSize2.Name = "1.77";

               size2.EcoResSize = new AxdEntity_EcoResSize[1] { ecoResSize2 };

               dimValue.MasterDim = new AxdEntity_MasterDim_EcoResProductMasterDimensionValue[2] { size, size2 };



                   client.create(context, dimValue);


               catch (Exception e)





  • Hello

    I am doing some study on AIF at this moment, and I am confuse with the following code

    AxdEntity_InventTable inventTable = new AxdEntity_InventTable();

               inventTable.ItemId = "Bulb60W";

               inventTable.Product = "Bulb60W";

    inventTable.product is surrogate foreign to the EcoResProduct table. My question is how does ax convert the Product name to the Recid? Is there anywhere inside the AX that define this relation? Please point me to the right direction.

    Thanks in Advance


  • Most of the work to do the translation from RecIds to natural keys and back is going to be deep in the AIF framework classes.  It may even be in kernel code.  Can I ask why you want to know?

Page 1 of 1 (4 items)