Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Microsoft Dynamics AX 2012 Development Cookbook
Microsoft Dynamics AX 2012 Development Cookbook

Microsoft Dynamics AX 2012 Development Cookbook: Customizing Dynamics AX to suit the specific needs of an organization is plain sailing when you use this cookbook of modifications. With more than 80 practical recipes it's the perfect handbook for all Dynamics AX developers.

eBook
$9.99 $32.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Microsoft Dynamics AX 2012 Development Cookbook

Chapter 2. Working with Forms

In this chapter, we will cover:

  • Creating a dialog

  • Handling a dialog event

  • Building a dynamic form

  • Adding a form splitter

  • Creating a modal form

  • Modifying multiple forms dynamically

  • Storing last form values

  • Using a tree control

  • Building a checklist

  • Adding the View details link

Introduction

Forms in Dynamics AX represent the user interface and are mainly used for entering or modifying data. They are also used for running reports, executing user commands, validating data, and so on.

Normally, forms are created using the AOT by creating a form object and adding form controls such as tabs, tab pages, grids, groups, data fields, images, and others. Form behavior is controlled by its properties or the code in its member methods. The behavior and layout of form controls are also controlled by their properties and the code in their member methods. Although it is very rare, forms can also be created dynamically from the code.

In this chapter, we will cover various aspects of using...

Introduction


Forms in Dynamics AX represent the user interface and are mainly used for entering or modifying data. They are also used for running reports, executing user commands, validating data, and so on.

Normally, forms are created using the AOT by creating a form object and adding form controls such as tabs, tab pages, grids, groups, data fields, images, and others. Form behavior is controlled by its properties or the code in its member methods. The behavior and layout of form controls are also controlled by their properties and the code in their member methods. Although it is very rare, forms can also be created dynamically from the code.

In this chapter, we will cover various aspects of using Dynamics AX forms. We start with building Dynamics AX dialog, and explaining how to handle its events. The chapter will also show how to build a dynamic form, how to add a dynamic control to existing forms, and how to make a modal form.

This chapter also discusses the usage of a splitter and...

Creating a dialog


Dialogs are a way to present users with a simple input form. They are commonly used for small user tasks, such as filling in report values, running batch jobs, presenting only the most important fields to the user when creating a new record, and so on. Dialogs are normally created from X++ code without storing actual layout in the AOT.

The application class Dialog is used to build dialogs. Other application classes, such as DialogField, DialogGroup, DialogTabPage, and others, are used to create dialog controls. A common way of using dialogs is within the RunBase framework classes, where user input is required.

In this example, we will demonstrate how to build a dialog from the code using the RunBase framework class. The dialog will contain customer table fields shown in different groups and tabs for creating a new record. There will be two tab pages, General and Details. The first page will have Customer account and Name input controls. The second page will be divided...

Handling a dialog event


Sometimes in the user interface, it is required to change the status of one field, depending on the status of another field. For example, if the user marks the Show filter checkbox, then another field, Filter, appears or becomes enabled. In AOT forms, this can be done by using the input control modified() event. However, if this feature is required on runtime dialogs, handling events are not that straightforward.

Very often, existing dialogs have to be modified to support eventing. The easiest way of doing that is of course to convert a dialog into an AOT form. However, in cases when the existing dialog is complex enough, probably a more cost effective solution would be to implement dialog event handling instead of converting it into an AOT form. Event handling in dialogs is not as flexible as in AOT forms, but in most cases it does the job.

In this recipe, we will create a dialog very similar to the previous one, but instead of entering the customer number, we will...

Building a dynamic form


A standard approach for creating forms in Dynamics AX is to create and store form objects in the AOT. Using this approach, it is possible to achieve a high level of complexity. However, in a number of cases, it is required to have forms created dynamically. In the standard Dynamics AX application we can see that application objects, such as the Table browser form, various lookups, or dialogs, are built dynamically.

In this recipe, we will create a dynamic form. In order to show how flexible it can be, we will replicate the layout of the existing Customer groups form located in the Accounts receivable module. It can be opened from Accounts receivable | Setup | Customers.

How to do it...

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

  1. 1. In the AOT, create a new class called CustGroupDynamic with the following code:

    class CustGroupDynamic
    {
    }
    public static void main(Args _args)
    {
    DictTable dictTable;
    Form form;
    FormBuildDesign design;
    FormBuildDataSource...

Adding a form splitter


In Dynamics AX, more complex forms consist of one or more sections. Each section may contain grids, groups or any other element. In order to maintain section sizes while resizing the form, the sections are normally separated by so-called splitters. Splitters are not special Dynamics AX controls; they are group controls with the properties modified so they look like splitters. Most of the multisection forms in Dynamics AX already contain splitters.

In this recipe, to demonstrate the usage of splitters, we will modify one of the existing forms that does not have a splitter. We will modify the Account reconciliation form in the Cash and bank management module, which can be opened from Cash and bank management | Bank accounts list page, by clicking on the Reconcile | Account reconciliation button in the action pane, and then selecting any of the existing records and hitting the Transactions button. In the following screenshot, you can see that it is not possible to control...

Creating a modal form


Quite often people who are not familiar with computers and software tend to get lost among open application windows. The same could be applied to Dynamics AX. Often a user opens one form, clicks a button to open another one, and then goes back to the first one without closing the second one. Sometimes this happens intentionally, sometimes not, but the result is that the second form is hidden behind the first one and the user starts wondering why it is not possible to close or edit the first form.

Such issues can be easily solved by making the child form a modal window. In other words, the second form always stays on top of the first one until closed. In this recipe, we will do exactly that. As an example, we will make the Create sales order form a modal window.

How to do it...

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

  1. 1. Open the SalesCreateOrder form in the AOT, and set its Design property:

    Property

    Value

    WindowType

    Popup

  2. 2. In order to...

Modifying multiple forms dynamically


In the standard Dynamics AX application, there is a class called SysSetupFormRun. Every runtime form inherits that class; therefore the class could be used to override some of the common behavior for all Dynamics AX forms.

For example, form background color could be changed depending on some parameters, some controls could be hidden or added depending on specific circumstances, and so on.

In this recipe, we will modify the SysSetupFormRun class to automatically add an About Microsoft Dynamics AX button to every form in Dynamics AX.

How to do it...

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

  1. 1. In the AOT, open SysSetupFormRun class, and create a new method with the following code:

    private void addAboutButton()
    {
    FormActionPaneControl actionPane;
    FormActionPaneTabControl actionPaneTab;
    FormCommandButtonControl cmdAbout;
    FormButtonGroupControl btngrp;
    #define.taskAbout(259)
    actionPane = this.design().controlNum(1);
    if (!actionPane ||
    !(actionPane...

Storing last form values


Dynamics AX has a very useful feature that allows saving of the latest user choices per user per form, report or any other object. This feature is implemented across a number of standard forms, reports, periodic jobs, and other objects, which requires a user input. When developing a new functionality for Dynamics AX, it is recommended to keep it that way.

In this recipe, we will demonstrate how to save the latest user selections. In order to make it as simple as possible, we will use existing filters on the General journal form, which can be opened from General ledger | Journals | General journal. This form contains two filters—Show and Show user-created only. The Show filter allows journals to be displayed by their posting status and the Show user-created only toggles between all journals and the currently logged in user's journals.

How to do it...

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

  1. 1. In the AOT, find the LedgerJournalTable form, and...

Using a tree control


Frequent users should notice that some of the Dynamics AX forms use tree controls instead of commonly used grids. In some cases, it is extremely useful, especially when there are parent-child relationships among records. It is a much clearer way to show the whole hierarchy compared to a flat list. For example, projects and their subprojects are displayed in the Projects form of the Project management and accounting module and give a much better overview when displayed in a tree layout.

This recipe will discuss the principles of how to build tree-based forms. As an example, we will use the Budget model form, which can be found in Budgeting | Setup | Budget models. This form contains a list of budget models and their submodels, and although the data is organized using a parent-child structure it is still displayed as a grid. In this recipe, to demonstrate the usage of tree controls, we will replace the grid with a new tree control.

How to do it...

Carry out the following...

Building a checklist


Anyone who has performed a Dynamics AX application installation or upgrade has to be familiar with standard checklists. Normally, a checklist is a list of menu items displayed in a logical sequence. Each item represents either mandatory or optional action to be executed by the user in order to complete the whole procedure. In custom Dynamics AX implementations, checklists can be used as a convenient way to configure non-standard settings. Checklists can also be implemented as a part of third-party modules for their initial setup.

In this recipe, we will create a checklist for user-friendly ledger budget setup. The checklist will consist of two mandatory items and one optional item.

How to do it...

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

  1. 1. Open the AOT, and create a new interface named SysCheckListInterfaceBudget:

    interface SysCheckListInterfaceBudget
    extends SysCheckListInterface
    {
    }
    
  2. 2. Create three classes, one for each checklist item, with the...

Adding the View details link


Dynamics AX has a very useful feature, which allows the user to open the main record form with just a few mouse clicks on the current form. The feature is called View details and is available in the right-click context menu on some controls. It is based on table relationships and is available for those controls whose data fields have foreign key relationships with other tables.

Because of the data structure integrity, the View details feature works most of the time. However, when it comes to complex table relations, it does not work correctly or does not work at all. Another example of when this feature does not work automatically is when display or edit methods are used on a form. In those and many other cases, the View details feature has to be implemented manually.

In this recipe, to demonstrate how it works, we will modify the General journal form in the General ledger module and will add the View details feature to the Description control, allowing users...

Left arrow icon Right arrow icon

Key benefits

  • Develop powerful, successful Dynamics AX projects with efficient X++ code with this book and eBook
  • Proven recipes that can be reused in numerous successful Dynamics AX projects
  • Covers general ledger, accounts payable, accounts receivable, project modules and general functionality of Dynamics AX
  • Step-by-step instructions and useful screenshots for easy learning
  • Numerous development tips and tricks for daily usage
  • This book is an update to Microsoft Dynamics AX 2009 Development Cookbook

Description

Microsoft Dynamics AX is a comprehensive Enterprise Resource Planning (ERP) solution for mid-size and large organizations. Dynamics AX implementations are used worldwide by thousands of customers. With the new version - Dynamics AX 2012 - 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. Written by one of the leading experts in Microsoft Dynamics AX, 'Microsoft Dynamics AX 2012 Development Cookbook' is packed with over 80 task-based and immediately reusable recipes that will help you manage your company's or customer'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. The recipes 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 practical recipes will also 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 and managing your data and functions will become easier.

Who is this book for?

If you are a Dynamics AX developer who is primarily focused on delivering time-proven application modifications, then this book is for you. Although new X++ developers will find this book useful, this book is focused more towards developers who already know the basics of Dynamics AX programming and want to step up to the next level and at the same time learn the functional aspects of Dynamics AX. Some Dynamics AX coding experience is expected.

What you will learn

  • Explore data manipulation concepts in Dynamics AX
  • Build scripts to assist data migration processes
  • Organize data in Dynamics AX forms
  • Enhance your application by using advanced form controls
  • Create custom lookups using AOT forms and dynamically generate them from the X++ code
  • Create and post Dynamics AX journals from code
  • Create and manage purchase and sales orders from code
  • Create a custom electronic payment format and process a vendor payment using it
  • Integrate your application with Microsoft Office Suite
  • Create various Microsoft Office documents that can be used for exporting/importing business data for further distribution or analysis
  • Integrate the system with external systems using various approaches
  • Improve your development efficiency and experience
  • Learn simple but effective tips on how to improve overall Dynamics AX performance

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 04, 2012
Length: 372 pages
Edition : 1st
Language : English
ISBN-13 : 9781849684651
Vendor :
Microsoft
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : May 04, 2012
Length: 372 pages
Edition : 1st
Language : English
ISBN-13 : 9781849684651
Vendor :
Microsoft
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 159.97
Microsoft Dynamics AX 2012 Services
$43.99
Microsoft Dynamics AX 2012 Development Cookbook
$54.99
Extending Microsoft Dynamics AX 2012 Cookbook
$60.99
Total $ 159.97 Stars icon
Banner background image

Table of Contents

9 Chapters
Processing Data Chevron down icon Chevron up icon
Working with Forms Chevron down icon Chevron up icon
Working with Data in Forms Chevron down icon Chevron up icon
Building Lookups Chevron down icon Chevron up icon
Processing Business Tasks Chevron down icon Chevron up icon
Integration with Microsoft Office Chevron down icon Chevron up icon
Using Services Chevron down icon Chevron up icon
Improving Development Efficiency Chevron down icon Chevron up icon
Improving Dynamics AX Performance Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2
(20 Ratings)
5 star 40%
4 star 45%
3 star 10%
2 star 5%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Bojan Jovicic Jul 18, 2012
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book contains a wealth of information about most of the key areas used while developing new or modifying existing functionalities in Microsoft Dynamics AX 2012. A warm recommendation for every Microsoft Dynamics AX 2012 developer.
Amazon Verified review Amazon
SA Jun 27, 2012
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is addressing the typical AX development tasks with easy steps to follow. I think it should be close to, at least, every technical person,... you don't know when it comes handy?
Amazon Verified review Amazon
Amazon customer Jul 15, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As Dynamics AX developers, we are working with a niche product and do not have an abundance of technical literature as more generic development technologies enjoy. One can find a lot of answers by googling but having an academic approach to learning I cannot overestimate the amount of knowledge one can pick up from reading a good book.The “Microsoft Dynamics AX 2012 R3 Cookbook” provides an excellent set of real-life scenarios and solutions that can be applied as is or help to come up with creative ways of approaching development tasks we face. The recipes apply to many areas of AX, are very well explained and come with well-written code samples.I highly recommend this book to those starting their Dynamics AX development career as well as mature developers who will still find new tricks or refresh their memory.
Amazon Verified review Amazon
Kambiz Jun 17, 2012
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Major changes in contrast with ax 2009 cook book, usefull topics, powerfull edition in order to follow the processes, merge technical with required functional point of view to complete the tasks...
Amazon Verified review Amazon
Hal 9000 Aug 18, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Not for the beginner, more focused on X++, class constructs and work around with suggestions, tips and tricks
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.