Thursday, July 16, 2020

How to create Product in Ax 2012 using X++

 Hi guys, Today we see how to create a product in ax 2012 using X++.
  • Just write the below code in your job and test it.
  • Just do changes based on your requirement. Here I have hot code the  DisplayProductNumber,Name fields.
  • Just change those fields as Your Unbound fields Like Identification_ProductNumber.valuestr(),Identification_Name.valuestr().


   EcoResProductTranslation ecoResProductTranslation;
EcoResDistinctProduct ecoResDistinctProduct; EcoResProductIdentifier ecoResProductIdentifier; //EcoResStorageDimensionGroup EcoResStorageDimensionGroup; //EcoResStorageDimensionGroupProduct EcoResStorageDimensionGroupProduct; //EcoResStorageDimensionGroupItem EcoResStorageDimensionGroupItem; //EcoResTrackingDimensionGroup EcoResTrackingDimensionGroup; //EcoResTrackingDimensionGroupProduct EcoResTrackingDimensionGroupProduct; //EcoResTrackingDimensionGroupItem EcoResTrackingDimensionGroupItem; accountnum _itemid='Dax123'; name _itemname='Dax123'; ecoResDistinctProduct.initValue(); ecoResDistinctProduct.DisplayProductNumber =_itemid; ecoResDistinctProduct.ProductType = EcoResProductType::Item; ecoResDistinctProduct.SearchName =_itemname; ecoResDistinctProduct.doInsert(); ecoResProductTranslation.initValue(); ecoResProductTranslation.LanguageId = "en-us"; ecoResProductTranslation.Description = _itemname; ecoResProductTranslation.Name = _itemname; ecoResProductTranslation.Product = ecoResDistinctProduct.RecId; ecoResProductTranslation.doinsert(); if(ecoresdistinctproduct.recid) { ecoresproductidentifier.initValue(); ecoresproductidentifier.product=ecoresdistinctproduct.recid; ecoresproductidentifier.productnumber=ecoResDistinctProduct.DisplayProductNumber\\_itemid; ecoresproductidentifier.insert(); } info('product created');


Keep Daxing !!

No comments:

Post a Comment