Sales order posting is also done in a very similar way to posting a purchase order. The posting function can be executed from code and can be integrated into various customizations.
In this recipe, we will use a standard Dynamics AX API to post and print a sales packing slip document from code. As an example, we will post and print a packing slip for the sales order created in the previous recipe.
In AOT, create a new class called SalesOrderPost with the following code (replace SO-100160 with your number):
class SalesOrderPost { } public static void main(Args _args) { SalesFormLetter salesFormLetter; salesTable salesTable; ; salesTable = SalesTable::find('SO-100160'); salesFormLetter = SalesFormLetter::construct( DocumentStatus::PackingSlip); salesFormLetter.update( salesTable, systemdateget(), SalesUpdate::All, AccountOrder::None, NoYes::No, NoYes...