Creating a sales order

Sales orders are used throughout the sales process to hold the information about goods or services that a company sells to its customers. Normally, sales orders are created from the user interface, but in automated processes, sales orders can be also created from code.

In this recipe, we will learn how to create a sales order from code. We will use a standard method provided by the application.

How to do it...

  1. In the AOT, create a new job named SalesOrderCreate with the following code:
    static void SalesOrderCreate(Args _args) { NumberSeq numberSeq; SalesTable salesTable; SalesLine salesLine; ttsBegin; numberSeq = NumberSeq::newGetNum( SalesParameters::numRefSalesId()); numberSeq.used(); salesTable.SalesId = numberSeq.num(); ...

Get Microsoft Dynamics AX 2012 Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.