How to confirm sales order through code in Ax 2012


Description:-

In this post I have create code for sales order confirmation, here we will see how to confirm sales order through code in dynamics ax 2012.This code is straight forward and simple. It has been very useful to me, because we made a lot of changes to the Sales Life cycle of Axapta.
Copy and paste below code and fill you sales order number which you want to confirm.

static void SalesOrderConfirmation(Args _args)
{
    SalesTable salesTable;
    SalesFormLetter salesFormLetter;      
    SalesTable = SalesTable::find(SalesOrderNumber');
    salesFormLetter = SalesFormLetter::construct(DocumentStatus::Confirmation);
    salesFormLetter.update(salesTable);
}

Here I have also written code for sales order confirmation through class, you can create method in class and confirm sales order, by passing the sales order number in this method you can confirm sales order.

public boolean confirmSalesOrder(SalesId _salesId)
{
    SalesFormletter SalesFormletter;
    SalesTable SalesTable;
    ;
    SalesFormletter = SalesFormletter::construct(DocumentStatus::Confirmation,true);
    SalesTable.clear();
    SalesTable = SalesTable::find(_salesId);
    SalesFormletter.update(SalesTable,systemDateGet(),SalesUpdate::All,AccountOrder::None,false,false);
}

What I did was create a Class that contained different methods for taking sales orders through the sales life cycle.

Related Posts

Previous
Next Post »

Thanks for comments.....