Create SalesLine from X++ code


static void createSalesLine(Args _args)
{
    SalesTable  salesTable  = SalesTable::find('012500');
    ItemId      itemId      = 'G0001';
    InventDimId inventDimId = '000051';
    SalesLine   salesLine;

    // performs relevant checks. Can we create line?
    // If sales order invoiced and sales ledger parameters Safety level of invoiced order parameter is set to Locked then we can not
    if (salesTable.checkUpdate(true))
    {
        salesLine.clear();
        salesLine.SalesId       = salesTable.SalesId;
        salesLine.ItemId        = itemId;
        salesLine.InventDimId   = inventDimId;
        salesLine.SalesQty      = 2;
        salesLine.createLine(true, true, true, true, true, true, true, true, '', false, true, true);
    }
}


 

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units.
Join us.

Blog Tags