Cancel salesline through code in D365 FO X++

 static void cancelSalesLine(Args _args)

{
    boolean updated;
    SalesLine salesLine; 
    
    try
    {
        ttsBegin;        
        
        salesLine = SalesLine::findInventTransId('012411', true);
    
        updated = SalesUpdateRemain::updateDeliveryRemainder(salesLine, 0, 0);
    
        if(updated)
        {
            info("Salesline canceled");    
        }        
        
        ttsCommit;
    }
    catch
    {
        error("SalesLine could not be canceled");
    }
}

Comments

Popular posts from this blog

How to Bypass Next in COC in D365 X++

create movement journal through code in d365 FO x++