Hello,
I am using Ax 2012.
I am trying to update the inventory dimensions value while creating a sales order through x++ code. My job runs without any error and sales order is created with the respective sales line.
But when I check the inventory transactions, Dimensions value is not shown. It fetches the correct DimId value from the InventDim table but still the value is not displayed.
I have used the following Code,
static void LearningSalesOrderWithInventDim(Args _args)
{
SalesTable salesTable;
NumberSeq NumberSeq;
SalesLine salesLine;
InventDim inventDim;
// Create the Sales Order
ttsbegin;
NumberSeq =NumberSeq::newGetNum(SalesParameters::numRefSalesId(),true);
salesTable.SalesId = NumberSeq.num();
salesTable.initValue();
salesTable.CustAccount = "2002";
salesTable.initFromCustTable();
salesTable.insert();
//Create the Sales Line with the created Sales Order
salesLine.clear();
salesLine.SalesId = salesTable.SalesId;
salesLine.ItemId = "1000";
salesLine.SalesQty = 3;
inventDim.clear();
inventDim.configId = 'Round';
inventDim.InventSizeId = '01';
inventDim.InventColorId = '01';
inventDim.InventStyleId = '01';
inventDim.inventBatchId = '000001';
inventDim.InventLocationId = 'VMIW';
inventDim = InventDim::findOrCreate(inventDim);
salesLine.InventDimId = inventDim.inventDimId;
salesLine.CreateLine(NoYes::Yes,
NoYes::Yes,
NoYes::Yes,
NoYes::Yes,
NoYes::Yes,
NoYes::Yes);
ttscommit;
info(salesTable.SalesId);
}
Please check the image below only site and warehouse is getting displayed.
Thanks