Book Image

Microsoft Dynamics AX 2012 R3 Development Cookbook

By : Mindaugas Pocius
Book Image

Microsoft Dynamics AX 2012 R3 Development Cookbook

By: Mindaugas Pocius

Overview of this book

<p>Microsoft Dynamics AX 2012 R3 Development Cookbook will help you manage your company's or customer's ERP information and operations efficiently. Beginning with exploring data manipulation concepts in Dynamics AX, you will build scripts to assist data migration and organize data in AX forms. You will learn how to create custom lookups using AOT forms and generate them dynamically. After this, you'll learn how to enhance your application by using advanced form controls, and integrate your system with other external systems. You will also learn how to enhance your user interface using various Dynamics AX UI elements.</p> <p>This book will help you look at application development from a business process perspective, and develop enhanced ERP solutions by learning and implementing the best practices and techniques.</p>
Table of Contents (16 chapters)
Microsoft Dynamics AX 2012 R3 Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a purchase order


Purchase orders are used throughout the purchasing process to hold 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 the code.

In this recipe, you will learn how to create a purchase order from the code. We will use one of the standard methods provided by the application.

How to do it...

Carry out the following steps in order to complete this recipe:

  1. In the AOT, create a new job named PurchOrderCreate with the following code snippet: (replace the values in the code to match your data)

    static void PurchOrderCreate(Args _args)
    {
        NumberSeq  numberSeq;
        PurchTable purchTable;
        PurchLine  purchLine;
    
        ttsBegin;
    
        numberSeq = NumberSeq::newGetNum(
            PurchParameters::numRefPurchId());
        numberSeq.used();
    
        purchTable.PurchId = numberSeq.num();
        purchTable.initValue();
        purchTable.initFromVendTable...