2021-07-16

[AX2009] Update SalesLine Qty by Code

 Update sales line Qty manually. This code also update remain qty in SalesLine tabale and qty in InventTrans table.

static void UpdateSalesLineQty(Args _args)
{
    SalesLine       salesLine;
    ;
    ttsbegin;
    salesLine = SalesLine::findInventTransId('14723621_068', true);
    salesLine.SalesQty = 3;//example
    salesLine.modifiedField(fieldnum(SalesLine, SalesQty));
    InventMovement::bufferSetRemainQty(salesLine);
    salesLine.update();
    ttscommit;
    info("Done");
}