Hi all,
I am trying to create a salesLine using following piece of code.SalesLine salesLine; InventDim inventDim; InventTable inventTable; salesLine.clear(); inventDim = null; salesLine.initValue(); salesLine.SalesId = salesTable.SalesId; salesLine.initFromSalesTable(salesTable); salesLine.ItemId = '123'; inventTable = InventTable::find(salesLine.ItemId); salesLine.initFromInventTable(inventTable); inventDim.selectForUpdate(true); inventDim.InventLocationId = "Value"; inventDim.InventSiteId ="Value"; inventDim.inventBatchId="Value"; salesLine.InventDimId = InventDim::findOrCreate(inventDim).InventDimId; salesLine.SalesQty = 1; salesLine.SalesPrice = 3200.00; salesLine.LineAmount = salesLine.calcLineAmount(); salesLine.createLine(true,true,false,true);
But the problem I am facing is that InventDimID in SalesLine gets replaced after "creatLine". InventDimID "before creatLine" is the one that has InventBatchID, but InventDimID "after createLine" is the one that does not have InventBatchID.
How can I prevent this from happening ? I want the inventDimID that has InventBatchID value.
↧
InventDimID gets replaced in SalesLine
↧