Creating a purchase order

Purchase orders are used throughout the purchasing process to hold the information about the goods or services that a company buys from its suppliers. Normally, purchase orders are created from the user interface, but in automated processes, purchase orders can be also created from code.

In this recipe, we will learn how to create a purchase 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 PurchOrderCreate with the following code:
    static void PurchOrderCreate(Args _args) { NumberSeq numberSeq; PurchTable purchTable; PurchLine purchLine; ttsBegin; numberSeq = NumberSeq::newGetNum( PurchParameters::numRefPurchId()); numberSeq.used(); purchTable.PurchId ...

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.