Posting a sales order
In Dynamics 365 for Finance and Operations, a sales order goes through a number of statuses in order to reflect its current position within the sales process. The status can be updated either manually using the user interface or programmatically from the code.
In this recipe, we will demonstrate how a sales order status can be updated from the code. We will register a packing slip for the sales order created in the previous recipe and print the relevant document on the screen.
How to do it...
Carry out the following steps in order to complete this recipe:
- Add a new
runnable class
, namedSalesOrderPostPackingSlip
with the following code snippet in the main method (replace000776
with your Sales Order number, that was generated after the previous code):
static void SalesOrderPostPackingSlip(Args _args) { SalesFormLetter salesFormLetter; salesTable salesTable; salesTable = SalesTable::find('000776'); salesFormLetter...