Wednesday, August 12, 2015

AX 2012 Get Item purchase price using x++

Question: I need to get Item purchasing price using x++ code.

Answer:

container result;

result = PriceDisc::findItemPriceAgreement(ModuleInventPurchSales::Purch, ItemId, InventDim, Unit, today(), Qty, VendAccountNum, CurrencyCode, "0");

purchPrice            = conPeek(result, 0);

Note: The variables shown above to pass as parameters are self explanatory and should be replaced with your variables.