O'Reilly logo

Microsoft Dynamics AX 2009 Development Cookbook by Mindaugas Pocius

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating sales orders

Creating sales orders in Dynamics AX is very similar to creating purchase orders both in the application and from code.

In this recipe, we will create a new sales order from code. We will use a similar approach to that which we used in the Creating purchase orders recipe.

How to do it...

  1. Open AOT and create a new class called SalesOrderCreate with the following code:
    class SalesOrderCreate
    
    {
    }
    public static void main(Args _args)
     { NumberSeq numberSeq; SalesTable salesTable; SalesLine salesLine; ; ttsbegin; numberSeq = NumberSeq::newGetNumFromCode( SalesParameters::numRefSalesId().numberSequence, true); salesTable.SalesId = numberSeq.num(); salesTable.initValue(); salesTable.CustAccount = '1101'; salesTable.initFromCustTable(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required