Book Image

Microsoft Dynamics AX 2009 Development Cookbook

By : Mindaugas Pocius
Book Image

Microsoft Dynamics AX 2009 Development Cookbook

By: Mindaugas Pocius

Overview of this book

Microsoft Dynamics AX provides a comprehensive Enterprise Resource Planning (ERP) solution for mid-size and larger organizations. Dynamics AX implementations are used worldwide by thousands of customers. With the new version - Dynamics AX 2009 - the system is due to expand even more rapidly. Every new implementation requires some level of customization, and all organizations want this to be done to the highest standards using proven approaches. This step-by-step guide will help you manage your company's ERP information and operations efficiently, and solve your business process problems in an effective and quick way. This book focuses on commonly used custom modifications in major Dynamics AX modules. This book contains commonly used bits of code which were real-world tested in at least one successful Dynamics AX implementation. Many of the recipes were deployed in many implementations and even across several versions of Dynamics AX. The examples in this book cover various areas of Dynamics AX to help developers not only learn about programming, but also about the functional side of Dynamics AX. The book should help developers who already know the basics of Dynamics AX programming to step up to the next level. The recipes allow you to look at the development from the perspective of business processes. You will learn to enhance your user interface using various Dynamics AX UI elements. Managing your data and functions will become easier. You will also get numerous development tips and tricks from a Dynamics AX development expert.
Table of Contents (12 chapters)
Microsoft Dynamics AX 2009 Development Cookbook
Credits
About the Author
About the Reviewers
Preface
Index

Preface

As a Dynamics AX developer, your responsibility is to deliver all kinds of application customizations, whether they are small adjustments or bespoke modules. Dynamics AX is a highly customizable system and requires a significant amount of knowledge and experience to deliver quality solutions. A single goal can be achieved in multiple ways, and there is always a question—which way is the best?

This book takes you through numerous practically proven recipes to help you with the daily development tasks. Each recipe contains detailed step-by-step instructions along with application screenshots and in-depth explanations. The recipes cover multiple Dynamics AX modules, and as a result, the book gives a developer an overview of the functional aspects of the system too.

What this book covers

The book's content is presented in six chapters covering the following areas:

Chapter 1, Processing Data focuses on data manipulation. It explains how to build data queries, how to check and modify existing data, and how to read or write comma-separated and XML files.

Chapter 2, Working with Forms covers the various aspects of using Dynamics AX forms. In this chapter, dialogs and their events are explained. Various useful features like splitters, saving last values, changing form appearance, dynamic controls, and others are also explained.

Chapter 3, Working with Data in Forms basically supplements the previous chapter and explains about data organization in forms. The examples in this chapter include instructions on how to build form data filters, process multiple records at a time, create data wizards, checklists, and the use of colors and images.

Chapter 4, Building Lookups covers all kinds of lookups in the system. The chapter starts with a simple automatically generated lookup, continues with more advanced ones, and finishes with standard Windows lookups like the file selection dialog or the color picker.

Chapter 5, Processing Business Tasks explains the usage of Dynamics AX business logic API. This chapter discusses topics on processing journals, purchase, and sales orders. Other features like posting financial vouchers directly, modifying transaction texts and creating electronic payment formats are included too.

Chapter 6, Integration with Microsoft Office shows how MS Word, Excel, Outlook, and Project can be used with Dynamics AX.

Who this book is for

This book is for Dynamics AX developers primarily focused on delivering time-proven application modifications. Although new X++ developers could use this book along with their beginner's guides, this book is more focused on people who are willing to raise their programming skills above the beginner's level and at the same time learn the functional aspects of Dynamics AX. So, some Dynamics AX coding experience is expected.

What you need for this book

All the coding examples were done in virtual Microsoft Dynamics AX 2009 Image from Microsoft Learning Download Centre. The following list of software from the virtual image was used in this book:

  • Microsoft Windows Server 2003 Enterprise Edition (Service Pack 2)

  • Dynamics AX 2009 RTM (kernel version: 5.0.593.0, application version: 5.0.593.0)

  • Microsoft Office Excel 2007

  • Microsoft Office Word 2007

  • Microsoft Office Outlook 2007

  • Microsoft Office Project 2007 (installed manually as an additional component)

  • Notepad

  • Internet Explorer 7

The mentioned software does not necessary have to be in a virtual image. The recipes could be implemented in any Dynamics AX 2009 RTM environment with no previous modifications.

Although all recipes were tested on the mentioned software, they might work on older or newer software versions without any implications or with minor code adjustments.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We call the table's renamePrimaryKey(), which does the actual renaming."

A block of code will be set as follows:

numRef.DataTypeId = typeId2ExtendedTypeId(typeid(EmplId));
 numRef.ReferenceHelp = literalstr("Employee identification");
 numRef.WizardContinuous        = false;
 numRef.WizardManual            = NoYes::No;
 numRef.WizardAllowChangeDown   = NoYes::Yes;

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be shown in bold:

public server static NumberSequenceReference numRefEmplId()
 {
     return NumberSeqReference::findReference(
         typeid2extendedtypeid(typeid(EmplId)));
 }

The code in this book generally follows the best practice guidelines provided by Microsoft, but there are some exceptions:

  • No text labels were used to make the code clear.

  • No three letter codes in front of each new AOT object were used.

  • No configuration or security keys were used.

  • Object properties that are not relevant to the topic being discussed are not set.

Some other considerations:

  • Each recipe demonstrates the principle and is not a complete solution.

  • The assumption is that no other modifications are present in the system.

  • The code might not have all possible validations that are not relevant to the principle being explained.

  • To demonstrate the principle and simplify the demonstration, the code in some recipes is placed in a job or in the main() of a newly created class to make sure it can be executed from AOT.

  • The code might have more variables than required to make sure it is clear for all audiences.

  • Sometimes unnecessary code wrapping is used to make sure the code fits into the page width of this book and is easily readable.

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "Click Transactions to note the existing transactions:"

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to , and mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code for the book

Visit http://www.packtpub.com/files/code/9423_Code.zip to directly download the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration, and help us to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or web site name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.