Greetings. We’re happy to announce that Inside Microsoft Dynamics AX 2009 (ISBN: 9780735626454; 720 pages), by The Microsoft Dynamics AX Team, is now available (it shipped to the printer in late May).
The Microsoft Dynamics AX Team focuses on business application innovation and developer productivity. The software architects, developers, test engineers, program managers, and leads who helped write this book spanned two continents yet shared a common vision: Deliver as much technical depth and developer-specific guidance as possible in a single reference.
Please note that this title is a second edition, replacing Inside Microsoft Dynamics AX 4.0 (ISBN: 9780735622579; 544 pages), which we published in 2006. The book has grown 32% to offer you even more detailed information about using Dynamics AX 2009 in advanced ways.
In this post you’ll find the book’s Foreword, written by Microsoft Product Unit Manager Hans J. Skovgaard; its Introduction, which describes how the new book is different from Inside Microsoft Dynamics AX 4.0); and an excerpt from Chapter 3, “The MorphX Tools.”
We hope you’ll find this new title helpful!
Here’s the Foreword:
In the course of our engagement with numerous partners and customers, we have learned
how much developers enjoy working with Microsoft Dynamics AX. We love building ever-
more-powerful versions of Dynamics AX that help our customers increase their
competitiveness; our partners love our product’s powerful set of development tools, which
allow them to build affordable and flexible enterprise resource planning (ERP) systems
whose quality and adaptability are second to none. Some of the examples in this book,
such as creating and exposing custom data sets to external applications through a Web
service, can be performed in 10 minutes or less. The very same examples would take at
least a week to complete in other ERP systems.
This is the second edition of this book. We received very positive feedback on the first
edition, Inside Microsoft Dynamics AX 4.0, from people who used the book for a variety of
purposes: from ramping up new teams and using the information in it to build presentations,
to giving copies to customers, prospects, and colleagues. Our aspiration for this new edition
is to incorporate the feedback we received on the original book and to cover the technologies
added to Dynamics AX 2009, such as ASP.NET for Enterprise Portal, new Workflow functionality,
Role Centers with advanced business intelligence, and the new Batch framework.
We believe that this book, which aims to provide developers with solid information on
advanced concepts, can make your entry into the powerful toolset for building business
applications a much smoother and more digestible learning experience. We hope that this
book is received as an insightful resource for many people working with Dynamics AX 2009.
I want to thank the coauthors for using their evenings and weekends to contribute to this book.
I wish you success with your implementation and customization of Microsoft Dynamics AX 2009.
Hans J. Skovgaard
Product Unit Manager
We understand if you’re a bit skeptical when we tell you that you are about to fall for a piece
of software. We want you to know up front that our intention is to show you all the wonderful
and amazing benefits that Microsoft Dynamics AX 2009 has to offer your business.
Here are some reactions from our partners and customers who have been involved in the
The release of Microsoft Dynamics AX 2009 shows a tremendous development
effort on Microsoft’s side not only for those already familiar with the product but
for newcomers too. This is the best release yet.
Jesper R. Hansen, Partner, thy:innovation
The completeness of the . . . release of Microsoft Dynamics AX 2009 will help
existing and new customers reduce the cost of additional customization and
therefore reduce the total implementation cost.
Sven Sieverink, Business Consultant, Dynamics Software
The out-of-the-box Role Centers in Microsoft Dynamics AX 2009 add value from
day one for all employees in our organization. Our users see enormous value with
the visuals, the ability to easily design cues, and the year-to-year comparison.
John Elmer, Vice President of Information Systems, Rodgers and Hammerstein
The Business Intelligence possibilities and integrated workflow offer my team
powerful tools to do the job themselves.
Greg Brock, Director Information Systems, Techmer PM
Who Is This Book For?
This book delves into the technology and tools in Dynamics AX 2009. New and experienced
developers are the intended target audience, and consultants will also benefit from reading
this book. The intention is not to give guidance on application functionality but rather to
offer as much technical information between the two covers as possible. It is also beyond the
scope of this book to include details about installation, upgrade, deployment, and sizing of
production environments. Refer to the extensive installation and implementation documentation
supplied with the product for more information on these topics.
To get full value from this book, you should have knowledge of common object-oriented
concepts from languages such as C++, C#, and Java. Knowledge of Structured Query
Language (SQL) is also an advantage. SQL statements are used to perform relational database
tasks such as data updates and data retrieval.
Note If you don’t have the Dynamics AX license that provides developer rights, you won’t be
able to perform most of the actions in this book. A virtual PC version of Dynamics AX 2009,
with developer rights, is available for partners to download at https://mbs.microsoft.com/partnersource/undefined
The History of Microsoft Dynamics AX
Historically, Dynamics AX envelops more than 25 years of experience in business application
innovation and developer productivity. Microsoft acquired Dynamics AX in 2002; the success
of the product has spurred an increasing commitment of research and development resources,
which allow Dynamics AX to continuously grow and strengthen its offering.
The development team that created Dynamics AX 2009 consists of three large teams, two
of which are based in the United States (Fargo, North Dakota, and Redmond, Washington)
and one based in Denmark (Copenhagen). The Fargo team focuses on finance and human
resources (HR), the Redmond team concentrates on Microsoft Project and CRM, and
Copenhagen team delivers Supply Chain Management (SCM). In addition, a framework
team, distributed over the three sites, develops infrastructure components. Finally, a worldwide
distributed team localizes the Dynamics AX features to meet national regulations or
local differences in business practices, allowing the product to ship in 24 main languages in
To clarify a few aspects of the origins of Dynamics AX, the authors contacted people who
participated in the early stages of the Dynamics AX development cycle. The first question we
asked was, How was the idea of using X++ as the programming language for Dynamics AX
We had been working with an upgraded version of XAL for a while called OO
XAL back in 1996/1997. At some point in time, we stopped and reviewed our
approach and looked at other new languages like Java. After working one long
night, I decided that our approach had to change to align with the latest trends in
programming languages, and we started with X++.
Erik Damgaard, cofounder of Damgaard Data
Of course, there were several perspectives among the developers on this breakthrough
One morning when we came to work, nothing was working. Later in the morning,
we realized that we had changed programming languages! But we did not have
any tools, so for months we were programming in Notepad without compiler or
Anonymous developer (but among the authors of this book!)
Many hypotheses exist regarding the origin of the original product name, Axapta. Axapta
was a constructed name, and the only requirement was that the letter X be included, to
mark the association with the predecessor XAL. The X association carries over in the name
Organization of This Book
Part I , “A Tour of the Development Environment,” is mainly for people new to Dynamics
AX. It describes the application architecture from the perspective of development,
deployment, and administration. The chapters in Part I also provide a tour of the internal
Dynamics AX development environment to help new developers familiarize themselves
with designers, tools, the X++ programming language, and the object-oriented application
framework that they will use to implement their customizations, extensions, and
Parts II (“Core Development Concepts”) and III (“Under the Hood”) are largely devoted to
illustrating how developers use the Dynamics AX application framework. Through code
samples written for a fictitious bicycle sales and distribution company, Part II describes how
to customize and extend Dynamics AX. The examples show how the fictitious company customizes,
extends, and integrates the application to support its online make-to-order sales,
distribution, and service operations.
If you are an experienced Dynamics AX developer, you might want to skip the tour of the
development environment after reading Chapter 1, “Architectural Overview,” and move
straight to Part II or Part III, which consist of chapters that can be read in random order. Or
use the book as a reference for subjects that you are especially interested in.
Differences from Inside Microsoft Dynamics AX 4.0
This book is an update to the book Inside Microsoft Dynamics AX 4.0. Along with changes
made to existing chapters, we added several new chapters, on workflow, Role Centers, the
Batch framework, reporting, and code upgrade. We have significantly expanded the performance
chapter, and the Enterprise Portal chapter now describes the new ASP.NET tooling.
We greatly extended the chapter “XML Document Integration” in the first edition, renaming
it as “The Application Integration Framework” (Chapter 17).
We removed the chapters on advanced MorphX forms and system classes because
these were least referenced by readers. You can find extensive documentation on MorphX
forms and system classes in the Dynamics AX 2009 software development kit (SDK), which
is on MSDN. And the previous version of this book is still a good source of information
because some of the technologies haven’t changed much. We also removed the chapter on
upgrade and data migration and replaced that content with a significantly enhanced series
of chapters on the version upgrade process, found in the bonus eBook, which can be found
on this book’s companion Web site: http://www.microsoft.com/learning/en/us/books/13345.
Finally, the chapter on unit testing has been merged into the chapter on the MorphX tools
In addition to this book, you can read thousands of topic pages of product documentation
on application and system issues in the online Help. Extensive documentation on installation
and implementation is available in the Microsoft Dynamics AX 2009 SDK and the Microsoft
Dynamics AX Implementation Guide, both supplied with the product. You can also find the
product documentation on MSDN. And if you have an installation of Dynamics AX 2009, you
have access to the following topic areas on the Help menu: Administrator Help, Developer
Help, and User Help.
Product Web Site
The user portal for Dynamics AX encompasses product and purchase information as well as
guidelines for using the product and links to online newsgroups and user communities.
For more information, visit the site http://www.microsoft.com/dynamics/ax.
With the latest version of the application, the name of the product changed to Microsoft
Dynamics AX 2009. The previous product versions were named Microsoft Axapta and
Microsoft Dynamics AX 4.0. For easier reading, this book refers to the 2009 version of the
product as Dynamics AX 2009 or just Dynamics AX and refers specifically to earlier versions
All relevant code examples are available for download. For details on the companion Web
site, see the “Code Samples” section later in this introduction. You might need to modify
some of the code samples to execute them. The necessary changes are described either
in the .xpo files themselves or in the readme fi le associated with the code samples on the
companion Web site.
Like all software, Dynamics AX involves the use of many abbreviations, acronyms, and technical
expressions. Much of this information is available in a glossary that you will find at the
back of the book. For a larger list of terms and abbreviations, refer to the glossary provided
with the product documentation.
To distinguish between SQL and X++ statements, this book uses the common practice for
SQL keywords, which is to display them in all capital letters. The following code shows an
example of this in connection with nested transactions, where a transaction is started in X++
and later sent to a SQL server.
You need the following hardware and software to build and run all the code samples for
- Microsoft Dynamics AX 2009: .NET Business Connector, Microsoft Dynamics AX 2009
Rich Client, Application Object Server (AOS; up and running)
- Windows Vista Business Edition, Ultimate Edition, or Enterprise Edition, Service Pack 1
or Windows XP Professional Edition, Service Pack 2/3 (for Microsoft Dynamics AX 2009
- Windows Server 2003 with Service Pack 2 or Windows Server 2008 (AOS Server)
- Microsoft SQL Server 2008 or Microsoft SQL Server 2005, Service Pack 2, Service Pack 3,
or Oracle Database 10g R2
- Windows SharePoint Services 3.0 with Service Pack 1 or Microsoft Office SharePoint
Server 2007, Enterprise Edition Service Pack 1 (to run Enterprise Portal or Role Centers)
- Microsoft SQL Server 2008 Reporting Services or Microsoft SQL Server 2005 Reporting
Services with SQL Server Service Pack 2/3 (to run SQL Reporting Services)
- Microsoft Visual Studio 2008
- Microsoft .NET Framework 3.5
- Intel Pentium/Celeron family or compatible Pentium III Xeon or higher processor minimum;
1.1 gigahertz (GHz) or higher recommended
- 1 gigabyte (GB) RAM or more recommended
- Video: at least 1024 × 768 high color 16-bit
- DVD-ROM drive
- Microsoft mouse or compatible pointing device
Because the requirements typically evolve with service packs that support new versions
of underlying technologies, we recommend that you check for the latest updated system
requirements at http://www.microsoft.com/dynamics/ax/using/2009systemrequirements.mspx.
This book was reviewed and tested against the RTM version of Dynamics AX 2009. Any
changes or corrections to this book will be added to a Microsoft Knowledge Base article. For
details, see the “Support for This Book” section in this introduction.
As technologies related to this book are updated, links to additional information will be added
to the Microsoft Press Technology Updates Web site. Visit this site periodically for updates on
Microsoft Visual Studio 2005 and other technologies: http://www.microsoft.com/mspress/updates.
All code samples discussed in this book can be downloaded from the book’s companion content
page at the following address: http://www.microsoft.com/learning/en/us/books/13345.aspx.
On the companion Web site you’ll find an eBook that contains several bonus chapters.
Chapter 1, “Introduction to Upgrade,” Chapter 2, “Code Upgrade” (also Chapter 18 of this
book), Chapter 3, “Data Upgrade,” and Chapter 4 “Upgrade Additional Topics.”
The upgrade information you find in this eBook gives you a solid overview of the Dynamics
AX 2009 upgrade process, tells you about the tools that are available to walk you through
the upgrade process, and gives you some tips and best practice guidelines; it does not give
you detailed procedures—simply because version upgrade is such a large topic. A wealth of
procedural and other information on the upgrade process is available with the Dynamics AX
product; we have included a list of those resources at the end of this introduction. You can
download the eBook from http://www.microsoft.com/learning/en/us/books/13345.aspx.
The MorphX Tools
In this chapter:
Application Object Tree 39
Project Designer 45
Property Sheet 49
X++ Code Editor 50
Label Editor 53
Visual Form Designer and Visual Report Designer 56
Code Compiler 59
Dynamics AX SDK 61
Best Practices Tool 62
Visio Reverse Engineering Tool 69
Table Browser Tool 75
Find Tool 76
Compare Tool 78
Cross-Reference Tool 83
Version Control 86
Unit Test Tool 96
The objectives of this chapter are to:
- Provide an overview of the tools used when developing a Microsoft Dynamics AX 2009
enterprise resource planning (ERP) application with MorphX.
- Share tips and tricks on how to use the MorphX tools efficiently.
- Demonstrate how to personalize and extend the MorphX tools.
Dynamics AX includes a set of tools, the MorphX development tools, that allow developers
to build and modify Dynamics AX business applications. Each feature of a business application
uses the application model elements described in Chapter 2, “The MorphX Development
Environment.” The MorphX tools enable developers to create, view, modify, and delete the
application model elements, which contain metadata, structure (ordering and hierarchies
of elements), properties (key and value pairs), and X++ code. For example, a table element
includes the name of the table, the properties set for the table, the fields, the indices, the
relations, the methods, and so on.
This chapter describes the most commonly used tools and offers some tips and tricks for
working with them. You can find additional information and an overview of other MorphX
tools in the MorphX Development Tools section of the Microsoft Dynamics AX software
development kit (SDK) 2009 on MSDN.
Tip To enable the development mode of Dynamics AX 2009, press Ctrl+Shift+D. Ctrl+Shift+D is
a toggle key that also returns you to content mode.
Table 3-1 lists the MorphX tools that are discussed in this chapter.
You can access these development tools from the following places:
- The Development Tools submenu on the Tools menu. From the Microsoft Dynamics AX
drop-down menu, point to Tools, and then point to Development Tools.
- The context menu on elements in the AOT.
Note The Microsoft Dynamics AX SDK contains valuable developer
documentation and is updated
frequently. Find it in the Microsoft Dynamics AX Developer Center on msdn.microsoft.com.
You can personalize the behavior of many MorphX tools by clicking Options on the Tools
menu. Figure 3-1 shows the Options dialog box.
Application Object Tree
The AOT is the main entry point to MorphX and is the repository explorer for all metadata.
You can open the AOT by clicking the AOT icon on the toolbar or by pressing Ctrl+D. The
AOT icon looks like this:
Navigating the AOT
As the name implies, the AOT is a tree view. The root of the AOT contains the element
categories, such as Classes, Tables, and Forms. Some elements are grouped into subcategories
to provide a better structure. For example, Tables, Maps, Views, and Extended Data Types
reside under Data Dictionary, and all Web-related elements are found under Web. Figure 3-2
shows the AOT.
You can navigate the AOT by using the arrow keys on the keyboard. Pressing the Right arrow
key expands a node if it has any children.
Elements are ordered alphabetically. Because thousands of elements exist, understanding the
naming conventions and adhering to them is important to effectively using the AOT.
All element names in the AOT follow this structure:
<Business area name> + <Business area description> + <Action performed or type of
In this naming convention, similar elements are placed next to each other. The business area
name is also often referred to as the prefix. Prefixes are commonly used to indicate the team
responsible for an element.
Table 3-2 contains a list of the most common prefixes and their descriptions.
Tip When creating new elements, make sure to follow the recommended naming conventions.
Any future development and maintenance will be much easier.
The Project Designer, described in detail later in this chapter, provides an alternative view of
the information organized by the AOT.
Creating New Elements in the AOT
You can create new elements in the AOT by right-clicking the element category node and
selecting New <Element Name>, as shown in Figure 3-3.
Objects are given automatically generated names when they are created. However, you should
replace the default names with new names in accordance with the naming conventions.
Modifying Elements in the AOT
Each node in the AOT has a set of properties and either subnodes or X++ code. You can use
the property sheet (shown in Figure 3-9) to inspect or modify properties, and you can use
the X++ code editor (shown in Figure 3-11) to inspect or modify X++ code.
The order of the subnodes can play a role in the semantics of the element. For example, the
tabs on a form display in the order in which they are listed in the AOT. You can change the
order of nodes by selecting a node and pressing the Alt key while pressing the Up or Down
A red vertical line next to an element name marks it as modified and unsaved, or dirty, as
shown in Figure 3-4.
A dirty element is saved in the following situations:
- The element is executed.
- The developer explicitly invokes the Save or Save All action.
- Autosave takes place. You specify the frequency of autosave in the Options dialog box
accessible from the Tools menu.
Refreshing Elements in the AOT
If several developers modify elements simultaneously in the same installation of Dynamics
AX, each developer’s local elements could become out of sync with the latest version. To
ensure that the local versions of remotely changed elements are updated, an autorefresh
thread runs in the background. This autorefresh functionality eventually updates all changes,
but you might want to explicitly force a refresh. You do this by right-clicking the element
you want to restore and then selecting Restore. This action refreshes both the on-disk and
the in-memory versions of the element. The following is a less elegant way of ensuring that the
latest elements are used:
1. Close the Dynamics AX client to clear in-memory elements.
2. Close the Dynamics Server service on the Application Object Server (AOS) to clear
3. Delete the application object cache files (*.auc) from the Local Application Data folder
(located in Documents and Settings\<User>\Local Settings\Application Data) to remove
the on-disk elements.
Note Before Dynamics AX 4.0, the application object cache was stored in .aoc files. To support
Unicode, the file extension was changed to .auc in Dynamics AX 4.0.
Element Actions in the AOT
Each node in the AOT contains a set of available actions. You can access these actions from
the context menu, which you can open by right-clicking the node in question.
Here are two facts to remember about actions:
- The actions available depend on the type of node you select.
- You can select multiple nodes and perform actions simultaneously on all the nodes
A frequently used action is Open New Window, which is available for all nodes. It opens a
new AOT window with the current nodes as the root. We used this action to create the screen
capture of the CustTable element shown in Figure 3-4. Once you open a new AOT window,
you can drag elements into the nodes, saving time and effort when you’re developing an
You can extend the list of available actions on the context menu. You can create custom
actions for any element in the AOT by using the features provided by MorphX. In fact, all
actions listed on the Add-Ins submenu are implemented in MorphX by using X++ and the
You can enlist a class as a new add-in by following this procedure:
1. Create a new menu item and give it a meaningful name, a label, and Help text.
2. Set the menu item’s Object Type property to Class.
3. Set the menu item’s Object property to the name of the class to be invoked by the
4. Drag the menu item to the SysContextMenu menu.
5. If you want the action available only for certain nodes, you need to modify the
verifyItem method on the SysContextMenu class.
Element Layers in the AOT
When you modify an element from a lower layer, a copy of the element is placed in the
current layer. All elements in the current layer appear in bold type (as shown in Figure 3-5),
which makes it easy to recognize changes. For a description of the layer technology, see the
section “Application Model Layering System” in Chapter 1, “Architectural Overview.”
You can use the Application Object Layer setting in the Options dialog box to personalize
the layer information shown in the AOT. Figure 3-5 shows a class with the option set to All
Layers. As you can see, each method is suffixed with information about the layers in which it
is defined, such as sys, var, and usr. If an element exists in several layers, you can right-click
it and select Layers to access its versions from lower layers. We highly recommend the All
Layers setting during code upgrade because it provides a visual representation of the layer
dimension directly in the AOT.
Note If you modify an element that exists in a higher layer than your current layer, all modifications
are redirected to the upper layer where the element is defined.