You are on page 1of 186

MICROSOFT DYNAMICS AX 2009

COURSE 80011: DEVELOPMENT I

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Last Revision: June 2008 The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Server and Microsoft Dynamics AX 2009 MorphX are trademarks or registered trademarks of Microsoft Corporation. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. This course content is designed for Microsoft Dynamics AX 2009.

2008 Microsoft Corporation. All rights reserved. Microsoft Dynamics, Microsoft PowerPoint Microsoft SQL

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Table of Contents Introduction to Development I in Microsoft Dynamics AX 2009 0-1

Welcome ............................................................................................................ 0-1 Microsoft Dynamics Courseware Contents ........................................................ 0-2 Documentation Conventions .............................................................................. 0-3 Student Objectives ............................................................................................. 0-4

Chapter 1: Microsoft Dynamics AX 2009 Architecture

1-1

Objectives ........................................................................................................... 1-1 Introduction ......................................................................................................... 1-1 Features of Microsoft Dynamics AX 2009 .......................................................... 1-2 Microsoft Dynamics AX 2009 Application Essentials ......................................... 1-6 Lab 1.1 - Filtering Records on the Customer Form .......................................... 1-17 Microsoft Dynamics AX 2009 Layered Architecture ......................................... 1-18 Tools for Customization .................................................................................... 1-26 Lab 1.2 - Moving a Column .............................................................................. 1-29 Security ............................................................................................................ 1-30 Inquiry and Reports .......................................................................................... 1-36 Lab 2.3 - Creating a Simple Inquiry on an Auto-Report.................................... 1-43 Summary .......................................................................................................... 1-44 Test Your Knowledge ....................................................................................... 1-45 Quick Interaction: Lessons Learned ................................................................. 1-46 Solutions ........................................................................................................... 1-47

Chapter 2: Data Dictionary

2-1

Objectives ........................................................................................................... 2-1 Introduction ......................................................................................................... 2-1 MorphX and the Application Object Tree............................................................ 2-1 Tables ................................................................................................................. 2-5 Creating Tables ................................................................................................ 2-11 Lab 2.1 - Table Creation ................................................................................... 2-17 Relations .......................................................................................................... 2-19 Data Types Primitive and Extended .............................................................. 2-22 Base Enumerations (Base Enums) .................................................................. 2-30 Maps ................................................................................................................. 2-34 Views ................................................................................................................ 2-35 Lab 2.2 - Views ................................................................................................. 2-41 Indices .............................................................................................................. 2-43 Lab 2.3 - Indices ............................................................................................... 2-46 Summary .......................................................................................................... 2-46 Test Your Knowledge ....................................................................................... 2-47 Solutions ........................................................................................................... 2-49

Chapter 3: User Interfaces

3-1

Objectives ........................................................................................................... 3-1 Introduction ......................................................................................................... 3-1 Projects .............................................................................................................. 3-2 Forms ................................................................................................................. 3-4 Lab 3.1 - Forms Creation ................................................................................. 3-16 Menus Items in MorphX ................................................................................... 3-19

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics AX 2009


Navigation Pane and Area Pages .................................................................... 3-25 Lab 3.2 - Menu Items Creation ......................................................................... 3-34 Microsoft Dynamics AX 2009 Non-graphical Objects ....................................... 3-35 Help Documentation ......................................................................................... 3-42 Summary .......................................................................................................... 3-44 Test Your Knowledge ....................................................................................... 3-45 Quick Interaction: Lessons Learned ................................................................. 3-46 Solutions ........................................................................................................... 3-47

Chapter 4: Report Adjustments

4-1

Objectives ........................................................................................................... 4-1 Introduction ......................................................................................................... 4-1 The Visual Report Designer ............................................................................... 4-2 Report Design .................................................................................................... 4-5 Report Templates ............................................................................................. 4-12 Summary .......................................................................................................... 4-15 Test Your Knowledge ....................................................................................... 4-16 Quick Interaction: Lessons Learned ................................................................. 4-17 Solutions ........................................................................................................... 4-18

Appendix A: Extending Microsoft Dynamics AX 2009 - A Case StudyA-1


Objectives .......................................................................................................... A-1 Introduction ........................................................................................................ A-1 Metadata Design ............................................................................................... A-2 Creating the Basic Data Objects ....................................................................... A-4 Creating the Graphical Components ................................................................. A-7 Summary ......................................................................................................... A-13 Quick Interaction: Lessons Learned ................................................................ A-14

ii

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Introduction

INTRODUCTION TO DEVELOPMENT I IN MICROSOFT DYNAMICS AX 2009


Welcome
We know training is a vital component of retaining the value of your Microsoft Dynamics AX 2009 investment. Our quality training from industry experts keeps you up-to-date on your solution and helps you develop the skills necessary for fully maximizing the value of your solution. Whether you choose Online Training, Classroom Training, or Training Materials; there is a type of training to meet everyone's needs. Choose the training type that best suits you so you can stay ahead of the competition.

Online Training
Online Training delivers convenient, in-depth training to you in the comfort of your own home or office. Online training provides immediate access to training 24 hours-a-day. It is perfect for the customer who does not have the time or budget to travel. Our newest online training option, eCourses, combine the efficiency of online training with the in-depth product coverage of classroom training, with at least two weeks to complete each course.

Classroom Training
Classroom Training provides serious, in-depth learning through hands-on interaction. From demonstrations to presentations to classroom activities, you receive hands-on experience with instruction from our certified staff of experts. Regularly scheduled throughout North America, you can be sure you will find a class convenient for you.

Training Materials
Training Materials enable you to learn at your own pace, on your own time with information-packed training manuals. Our wide variety of training manuals feature an abundance of tips, tricks, and insights you can refer to again and again:

Microsoft Dynamics Courseware


The Microsoft Dynamics Courseware consists of detailed training manuals, designed from a training perspective. These manuals include advanced topics as well as training objectives, exercises, interactions and quizzes. Look for a complete list of manuals available for purchase on the Microsoft Dynamics website: www.microsoft.com/Dynamics.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

0-1

Development I in Microsoft Dynamics AX 2009

Microsoft Dynamics Courseware Contents


Test Your Skills
Within the Microsoft Dynamics Training Materials you find a variety of different exercises. These exercises are offered in three levels to accommodate the variety of knowledge and expertise of each student. We suggest you try the level three exercises first, if you need help completing the task look to the information in the level two exercises. If you need further assistance each step of the task is outlined in the level one exercise.

Challenge Yourself!
Level 3 exercises are the most challenging. These exercises are designed for the experienced student who requires little instruction to complete the required task.

Need a Little Help?


Level 2 exercises are designed to challenge students, while providing some assistance. These exercises do not provide step by step instructions, however, do provide you with helpful hints and more information to complete the exercise.

Step by Step
Level 1 exercises are geared towards new users who require detailed instructions and explanations to complete the exercise. Level 1 exercises guide you through the task, step by step, including navigation.

Quick Interaction: Lessons Learned


At the end of each chapter within the Microsoft Dynamics Training Material, you find a Quick Interaction: Lessons Learned page. This interaction is designed to provide the student with a moment to reflect on the material they have learned. By outlining three key points from the chapter, the student is maximizing knowledge retention, and providing themselves with an excellent resource for reviewing key points after class.

0-2

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Introduction

Documentation Conventions
The following conventions and icons are used throughout this documentation to help you quickly and effectively navigate through the information.
CAUTION: Cautions are found throughout the training manual and are preceded by the word CAUTION in bold. Cautions are used to remind you of a specific result of a specific action which may be undesirable. HINT: Hints are found throughout the training manual and are preceded by the word HINT in bold. Hints are used to suggest time-saving features or alternative methods for accomplishing a specific task. NOTE: Notes are found throughout the training manual and are preceded by the word NOTE in bold. Notes are used to provide information which, while not critical, may be valuable to an end user. BEYOND THE BASICS: Advanced information found throughout the training manual is preceded by the words BEYOND THE BASICS in bold. Beyond the Basics provides additional detail, outside of standard functionality, that may help you to more optimally use the application. EXAMPLE: Examples are found throughout the training manual and are preceded by the word EXAMPLE in bold. Examples bring to light business scenarios that may better explain how an application can be used to address a business problem.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

0-3

Development I in Microsoft Dynamics AX 2009

Student Objectives
What do you hope to learn by participating in this course? List three main objectives below. 1.

2.

3.

0-4

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture

CHAPTER 1: MICROSOFT DYNAMICS AX 2009 ARCHITECTURE


Objectives
The objectives are: Understand the advantages of using Microsoft Dynamics AX 2009 Understand the main elements of Microsoft Dynamics AX 2009 development Effectively navigate throughout Microsoft Dynamics AX 2009 Understand the layered architecture of Microsoft Dynamics AX 2009 Understand the basic security architecture Become familiar with Microsoft Dynamics AX 2009 reporting

Introduction
Microsoft Dynamics AX 2009 is a customizable, multiple-language, and multiple-currency Enterprise Resource Planning (ERP) solution. Microsoft Dynamics AX 2009 excels in: Manufacturing E-business Wholesale Services industries

Microsoft Dynamics AX 2009 is a completely integrated solution. It is Webenabled and supports Microsoft SQL Server and Oracle. With customizable source code, the solution can be modified however and whenever it is necessary.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-1

Development I in Microsoft Dynamics AX 2009

Features of Microsoft Dynamics AX 2009


Microsoft Dynamics AX 2009 provides unique and powerful features within functional areas and the development environment. The features of Microsoft Dynamics AX 2009 are summarized here: Functional Features o o o o o Single database architecture is used for all companies in the organization A highly integrated design between functional areas such as resource planning, sales, and manufacturing Dimension-based system for Manufacturing and Financial modules Advanced features such as Forecasting and Master Planning are available Multicurrency and Multilanguage capabilities

Development Environment Features o Microsoft Dynamics AX 2009 MorphX is an integrated development environment (IDE) for developing in Microsoft Dynamics AX 2009 The .NET Business Connector provides access to the complete Microsoft Dynamics AX 2009 API allowing for easy integration of third-party and Web applications to Dynamics Ax Classes The Application Object Tree (AOT) provides a uniform and compact programming framework and viewing repository Drag-and-drop functionality is supported for many programming tasks Projects help organize and track customized applications in Microsoft Dynamics AX 2009

o o o

Elements of Microsoft Dynamics AX 2009 Development


Microsoft Dynamics AX 2009 Object Server
The Microsoft Dynamics AX 2009 Object Server (AOS) is the second-tier application server in the Microsoft Dynamics AX 2009 three-tier architecture. The three-tier environment is divided as follows: First Tier - Intelligent Client Second Tier - AOS Third Tier - Database Server

1-2

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


The AOS executes Microsoft Dynamics AX 2009 business logic that provides for scalability, flexibility, and better performance for properly designed objects. In this three-tier solution the database runs on a server as the third tier; the AOS handles the business logic in the second tier. The thin client is the first tier and it handles the user interface and necessary program logic. The Figure below shows Tier Interaction Diagram illustrates the interaction between the three tiers.

FIGURE 1.1 TIER INTERACTION DIAGRAM

The AOS architecture is highly scalable. As a business grows and the number of Microsoft Dynamics AX 2009 users increase, expand the capacity of Microsoft Dynamics AX 2009 by adding an additional AOS to the second tier. The additional server provides load balancing and introduces failover safety into the environment.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-3

Development I in Microsoft Dynamics AX 2009


Application Object Tree
The Application Object Tree (AOT) is a tree view of all the application objects within Microsoft Dynamics AX 2009. The AOT contains everything needed to customize the look and functionality of a Microsoft Dynamics AX 2009 application. Use the drag-and-drop features of the AOT to create and modify application objects without writing any code.

FIGURE 1.2 AOT EXAMPLE

IntelliMorph
IntelliMorph is the technology that controls the user interface in Microsoft Dynamics AX 2009. The user interface is how the functionality of the application is presented or displayed to the user. The same functionality can be displayed on multiple platforms or devices that use the same application code; for example, through the Web or through Mobile devices. IntelliMorph controls the layout of the user interface and makes it easier to modify forms, reports, and menus.

MorphX
The MorphX Development Suite is the integrated development environment (IDE) in Microsoft Dynamics AX 2009 used to develop and customize both the Windows interface and the Web interface. An IDE integrates development functions such as designing, editing, compiling, and debugging within a common environment. With MorphX, common operations such as building or modifying forms, menus, and reports are done using drag-and-drop techniques with little or no coding.

1-4

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


Inheritance
A core concept of MorphX is inheritance. Think of inheritance as a child object receiving properties from a parent object. Characteristics of inheritance include the following: What is defined at a higher level in the system is automatically inherited by lower levels Microsoft Dynamics AX 2009 is flexible and modifiable on many levels because of this hierarchical structure A single parameter can be modified for the whole system to inherit the change. For example, if the length of a database field changes from ten to twenty characters, the change is automatically reflected on all forms that contains the field The concept of inheritance is used in all object-oriented programming languages. Their definition differs slightly. The objectoriented programming concept of inheritance refers to one class inheriting methods from a base class

X++ X++ is the object-oriented programming language that is used in the MorphX environment. When working with X++, reference the Microsoft Dynamics AX 2009 Developer Help, available from the Help menu. This manual introduces the X++ environment. Additional training offerings discuss X++ in detail.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-5

Development I in Microsoft Dynamics AX 2009

Microsoft Dynamics AX 2009 Application Essentials


Basic Navigation
Navigation Pane: When first opening Microsoft Dynamics AX 2009, the Navigation Pane appears. This menu contains all the purchased modules in the license code. From here, the user can browse to any module in Microsoft Dynamics AX 2009.

FIGURE 1.3 NAVIGATION PANE

Area Page: An Area Page is a Microsoft Dynamics AX 2009 navigation page that displays menu items that link to list pages, content pages, forms, reports, classes, jobs, and queries. To view an area page, click a module button in the Navigation Pane. The area page opens in the client content pane that is automatically generated using the menu information for that module. The Area Page will be discussed in detail in a later course.

Working with Data in Forms


Creating New Records
Within each module tasks can be performed such as creating new records. For example, in the Accounts Receivable module customers can be added and sales orders created.

1-6

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


Demonstration: Creating a New Record in the Customer Table
This course uses the Contoso Entertainment USA Company to illustrate Microsoft Dynamics AX 2009s functionality. 1. Open the customer form located in the Accounts Receivable module. (Accounts Receivable/Common Forms/Customer Details) 2. Press CTRL + N to create a new blank row in the customer form. 3. Enter the following data into the fields: o Customer account: 4099 o Name: Wholesale Foods o Customer group: 30

FIGURE 1.4

NOTE: The wavy red underline in empty fields indicates a mandatory field. The record cannot be saved until these fields contain data. The data is automatically saved into the database after moving away from the new record.

Sorting Records
When working with data in a form it is sometimes necessary to change the sort order of the data to find specific information more easily. Records can be sorted in a form using three different methods.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-7

Development I in Microsoft Dynamics AX 2009


Demonstration: Sorting Records
1. Click the header of the sorting column. Records are sorted in descending order. Clicking the header again sorts in ascending order. 2. Right-click on a field in the column to sort. The shortcut menu appears with the options to sort in ascending or descending order.

FIGURE 1.5 SORTING RECORDS

3. Sort records by selecting either Sort Ascending or Sort Descending from the Edit/Sort menu in the menu bar. o To remove the sort order, click the Remove Filter icon in toolbar

Filtering Records
Sorting works well when working on a small set of data. However, to work efficiently with large amounts of data, filter the data to work with a specific subset of information. There are three ways to filter data in the user interface: Current content of a field Using an inquiry dialog where the criteria for the filter is specified Filter by grid

Using X++ code, there are many more ways to filter data; this chapter focuses on how to use MorphX utilities.

1-8

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


Demonstration: Filtering Records on the Sales Order form
The following demonstration filters data in a form that is based on the current content of a field. Ensure that the form is set as Advanced. 1. Open the Sales Order form in the Accounts Receivable module. a. Filter the sales order form so that it displays only the orders for customer account number 3003. 2. Put the pointer in the Customer account field that contains the value 3003. 3. Right-click and select Filter By Selection on the shortcut menu.

FIGURE 1.6

Now, only the sales orders for account number 3003 appear. 4. To remove this filter, click the Remove Filter icon on the toolbar.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-9

Development I in Microsoft Dynamics AX 2009


This demonstration filters the sales order form using the inquiry dialog box. 1. With the sales order form open, click the Advanced Filter/Sort icon on the toolbar.

FIGURE 1.7 FILTERING FROM THE TOOLBAR

2. After clicking the Advanced Filter/Sort icon, an inquiry dialog appears where the criteria can be specified for the filter. Click the OK button to return to the sales order form where only the records reflecting the specific criteria appear. o Again, if necessary, click the Remove Filter icon in the toolbar to remove the current filter. Filtering by grid provides the option to select one of ten expressions in a filter for each field in the grid.

FIGURE 1.8 FILTERING BY GRID

1. Click the Filter By Grid icon and select a filtering expression for the field.

FIGURE 1.9 FILTER BY GRID

1-10

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


Filters can be used on the grid. This example causes the Customers table to show only records where the Name field contains co.

FIGURE 1.10

Finding Records
Use the Global Search option to search for information across selected tables. There are three ways to start a Global Search. From the Menu Pane: Select the Find option on the Edit menu Select the Binocular icon from the toolbar Press Ctrl + F

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-11

Development I in Microsoft Dynamics AX 2009


Before using the Global Search feature set up the Data Crawler. 1. Select the tables and fields to be included in the Global Search. Click Basic > Setup > Data Crawler > Table Setup. 2. On the Overview tab, add the tables required for the search.

FIGURE 1.11 TABLE SETUP OVERVIEW TAB

1-12

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


3. On the Text index tab select the fields for each table. 4. Start the Data Crawler. Click Basic > Setup > Data Crawler > Data Crawler.

FIGURE 1.12 DATA CRAWLER OVERVIEW TAB

5. On the Overview tab, add the Companies to be included in the Global Search.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-13

Development I in Microsoft Dynamics AX 2009


6. To set up parameters and start the Data Crawler, open the Crawler tab. 7. Select the Start Crawler button.

FIGURE 1.13 DATA CRAWLER SETUP CRAWLER TAB

The Global Search is now ready to use. In addition to sorting and filtering, use the find functionality within Microsoft Dynamics AX 2009 to move to: A specific record. A range of records. A group of records that contains the same value or text.

The find functionality can be invoked in several ways. NOTE: Use wildcard characters (that is, ?, *) within the Find dialog to help broaden a search.

CAUTION: When using the Data Crawler with companies with large database tables, be aware of the significant time requirement for building indices on large tables.

1-14

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


Scenario
A customer who has account number 3003 calls the Sales Department to ask about an order; however, the customer has forgotten the order number. The salesperson uses the Global Search to find all sales orders for Customer 3003. The salesperson types 3003 in the Search for field and clicks the button to the right of the field. All records matching the criteria are sorted into Categories. The salesperson selects the Sales order category. By using the customer number as the search criteria, the customer can identify the specific order.

FIGURE 1.14 SEARCH HEADER

The sales person then select the Categories for the records to be displayed. The sales person then select Customer Transactions to receive a list of all transactions matching the search criteria and then click the specific order. This action opens the order directly from the list view.

The Help System


Microsoft Dynamics AX 2009 has an extensive help system that includes: General help Application development help

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-15

Development I in Microsoft Dynamics AX 2009


General help is available from the Microsoft Dynamics AX 2009 application menu bar and provides help for the complete Microsoft Dynamics AX 2009 application. This help document can be modified to include specific information about the customizations.

FIGURE 1.15 CONTEXT-SENSITIVE HELP

The Microsoft Dynamics AX 2009 Developer Help contains information specific to developing or customizing Microsoft Dynamics AX 2009 applications and can be accessed from the Microsoft Dynamics AX 2009 application help menu. The reference documentation within the Developer Help is also available by double-clicking the relevant object in the AOT. The AOT includes documentation on many application objects in Microsoft Dynamics AX 2009.

1-16

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture

Lab 1.1 - Filtering Records on the Customer Form


Filtering records using the Filter by Selection functionality. Scenario The user wants only to view customer records in the customer group 30.

Challenge Yourself!
The Customer form has many customers in different customer groups. Using the Filter by Selection functionality in Microsoft Dynamics AX 2009, filter the Customer details form to display only customers in Customer Group 30.

Need a Little Help?


1. Right-click on the column to locate the Filter by Selection.

Step by Step
1. Open the Customer details form in the Accounts Receivable module. 2. Place the cursor in the Customer Group field that contains the value 30. 3. Right-click and select Filter by Selection from the shortcut menu. 4. To remove this filter, click the Remove Filter icon on the Toolbar.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-17

Development I in Microsoft Dynamics AX 2009

Microsoft Dynamics AX 2009 Layered Architecture


The method used by Microsoft Dynamics AX 2009 to separate and control the updates and modifications made in the application is known as "layering." Layers are a hierarchy of levels in the application source code that make sure modifications and additions can be made without interfering with the application objects on the level lower than the user's. When modifying an object on one level, the modified object overshadows the object on a lower level. Layering is one of the most attractive features for developers and businesses because it enables software to "fit business needs."

Application Object Layers


The advantages to the layered architecture of Microsoft Dynamics AX 2009 include the following: Any user of the Microsoft Dynamics AX 2009 application can customize the Microsoft Dynamics AX 2009 application The standard application is never overwritten Deleting an object removes it either in the current layer or the layer above if the object exists in a higher layer. Every time an object is opened, the system automatically searches for and uses the object files needed in the highest layers first

Each layer is saved in a separate file that has an extension of .aod. For example, Axsys.aod is the SYS layer. The aod extension is an acronym for Application Object Data file. The layers are designed for different Microsoft Dynamics AX 2009 developer groups. Three groups have an interest in adding or modifying application objects: Microsoft Business Solution Developers who create the standard application Business partners and developers who want to enhance Microsoft Dynamics AX 2009 Microsoft Dynamics AX 2009 end-users

1-18

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


The following figure illustrates the hierarchy of the seven layers in Microsoft Dynamics AX 2009.

FIGURE 1.16 HIERARCHY OF LAYERS

System Application Layers (From Lowest to Highest)


The innermost layers (SYS, GLS, HFX, SL1, SL2, and SL3) are the standard layers in Microsoft Dynamics AX 2009: SYS - The innermost layer is the System or SYS layer. This is where the standard Microsoft Dynamics AX 2009 application is implemented GLS - Local Microsoft Dynamics AX 2009 offices are provided with a Global Localization or GLS layer for country-specific functionality HFX - The application layer that may be used for on-demand hot fixes SL1, SL2, and SL3 - The SL1, SL2, and SL3 layers are managed by distributors and are used for vertical partner solutions

NOTE: Object ID's in the standard layers are in the range of 1-20000. The four outermost layers (BUS, VAR, CUS, and USR) are modified by developers or end-users: BUS - Business partners can develop and distribute vertical and horizontal solutions to other partners and customers using the Business Solution or BUS layer

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-19

Development I in Microsoft Dynamics AX 2009


Solutions in the BUS layer are protected by the same license code framework the standard application uses. The BUS layer is reserved for the Add-on Solution program and requires a signed agreement to use for development and distribution. BUS layer Object ids range from 20001 - 30000. VAR - Business partners access a separate layer, the Value Added Reseller or VAR layer without business-related restrictions. This means that any developments can be added to this layer

The business partner must keep a catalog of application functionality and VAR configurations customers have implemented to update installations correctly. VAR layer Object id's range from 30001 - 40000. CUS - Corporate enterprises and business partners can modify their installations using the Customer or CUS layer. If a corporate enterprise has an internal IT Department with Microsoft Dynamics AX 2009 programming skills, use this layer to add generic enterprise modifications

The Customer layer supports in-house development without jeopardizing modifications made by the business partner. This means application code made in the VAR layer cannot be changed. CUS layer object id's range from 40001 50000. USR - The USR layer enables individual companies or companies in an enterprise to use this layer to make customizations that are unique to the customers installation that includes reports by using the report wizard

The USR layer object id's range from 50001 - 60000.

Patch Layers
In addition to the seven layers, each layer has one patch layer to help incorporate updates into a current application. When a patch file is present, modified objects in the patch file take precedence over regular objects and are used automatically. Patch files for a specific layer are stored in files that have the extension aod and contain a p within the name. For example, Axsyp.aod is a patch file included in the system layer. Object layers are visible in the AOT. The layer in which an object resides is listed in parentheses after the object's name if this option is chosen. NOTE: Refer to Microsoft PartnerSource or CustomerSource for up to date information on deployment strategies for Service Packs and Hotfixes. NOTE: The Administration in Microsoft Dynamics AX 2009 course addresses the procedures for the application of Service Packs and Hotfixes.

1-20

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


AOT Display of Layers
To select to view the application object layers for any object in the AOT: 1. Select Tools > Options. 2. On the Development tab click the drop-down box next to the Application object layer field.

FIGURE 1.17 OPTIONS DEVELOPMENT TAB

The menu choices are as follows: Show no layers - No objects are labeled with a layer indicator Show all layers - All objects are labeled with layer indications for all layers in which they exist Show highest layer - Shows only the highest layer where the object has been modified Show corrected layers - Shows only objects modified in the current layer or higher and labeled with indication of the highest layer Show all from corrected layers - Shows only objects modified in the current layer or a higher layer, with an indication of all layers of modification

NOTE: By using the Show All Layers option, a developer can see all layers that an object might reside in. This can allow the developer to use informed judgment when modifying an object.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-21

Development I in Microsoft Dynamics AX 2009


Label Files
The names given to application objects when they are created in the AOT are not viewed by the user who is working with the system. Microsoft Dynamics AX 2009 uses a label system which systematizes all the labels (for buttons, forms, dialog boxes, and more) for a specific language in one file; a label file. A label is the text that appears in the user interface. For example, the CustTable has a database field named CustAccount; however, the label in the application is Customer Account. This is done by defining the Label property for the Extended Data Type That Is Used in the database field. Set the Label property at the Extended Data Type level to make sure it is inherited on all objects where Extended Data Type is used as a source.

FIGURE 1.18 EXAMPLE LABEL/FIELD NAME

When creating a label file, a reference is made to a label data file (.ald) in the file system that stores all the label files numbers and text. The label files are allocated numerically, such as @SYS120 and @SYS121. Label files are stored in the application folder and use an extension of .ald. The .ald extension is an acronym for Microsoft Dynamics AX 2009 Label Data.

1-22

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture

NOTE: Due to risk of overwriting label files during an upgrade, the following abbreviations should NOT be used: SYS, SYP, GLS, GLP, HFX, SL1, SL2, SL3, BUS, BUP, VAR, VAP, CUS, CUP, USR, USP.

The Label File Wizard


The Label File Wizard helps create and update label files. The label file wizard can be located in Tools > Development Tools > Label > Label File Wizard.

FIGURE 1.19 MENU PATH TO LABEL FILE WIZARD

1. Navigate to Tools > Development Tools > Label, and select Label file Wizard. This opens the Label File Wizard. 2. Select the Create a new label file ID field. In this case, only create a new label file ID. 3. Create a label file ID named MBS. This is how the system references the new label file. This ID must be unique and contain only three letters. 4. Click Finish. Before writing any newly created label files, shut down Microsoft Dynamics AX 2009 and restart.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-23

Development I in Microsoft Dynamics AX 2009


Label Editor Form
This figure shows the Label editor form used to create new labels for application objects. Access the form by clicking the Browse button in the Label property field in the property sheet.

FIGURE 1.20 LABEL EDITOR

This is where the user searches for existing labels to use or add a custom label. 1. Type the name of the label in the Find what: field and then click Find now. The system searches all available label names to check if the label exists. If it exists, as long as the label is highlighted, the user can reuse it by selecting Paste label. If the label does not exist, create a new one by pressing CTRL + N. 2. Click the Advanced tab. When creating a new label, select which label file ID to create the new labels in.

1-24

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


The new label file ID created in the Label file Wizard is available in the dropdown list. 1. Select one or more languages to view translations of the current label or create translations of the new label. 2. Select the Auto Search function for the system to automatically start to search when the label dialog opens.

FIGURE 1.21 LABEL EDITOR SETUP TAB

NOTE: If the Version Control System is started the procedure is different. This is discussed in a later course.

Assign Labels to Objects


When a new application object is created, a label must be assigned in the properties. In some places the feature is called Label (for Extended Data Types), and in other places it is called Caption (Design node of forms). Reuse labels whenever possible by searching for the label, finding it in another label file, and using it for the object. NOTE: Label updates are only committed to the .ALD file when exclusive access to the label file is available, such as when AOS is restarted.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-25

Development I in Microsoft Dynamics AX 2009

Tools for Customization


There are three main tools for customizing Microsoft Dynamics AX 2009 depending on the complexity of the customization. The tools are as follows: IntelliMorph MorphX X++

IntelliMorph
Intellimorph is the automatic layout generation of forms, reports, and menus.

Demonstration: Using Intellimorph


The following demonstration shows how to use IntelliMorph to hide the Recipient field on the sales order form in Microsoft Dynamics AX 2009. 1. Open the Sales Order form. 2. Confirm that the form is being viewed in the Simple view. 3. Right-click the Recipient field and select Hide from the context menu.

FIGURE 1.22 HIDING A FIELD ON THE SALES FORM

1-26

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


o To make the Recipient field visible, right-click anywhere on the Sales Order form and select SHOWRECIPIENT.

FIGURE 1.23 SHOWING A HIDDEN FIELD ON THE SALES FORM

IntelliMorph uses a drag-and-drop technique to rearrange fields on a form. For example, to rearrange the fields on the customer form: 1. Open the Customer form. 2. Click and hold the header for the Customer account column. 3. When holding down, drag it to the right of the header for the customer Search name column and drop it. NOTE: To enable this functionality, the Advanced Form Customizations option must be selected under the Administration node in the configuration key tree. The Configuration form is located in the Administration Module > Setup > System. Configuration keys are discussed later.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-27

Development I in Microsoft Dynamics AX 2009


Notice that the Customer account is now the fourth column in the form.

FIGURE 1.24 RELOCATING A FIELD ON THE CUSTOMER FORM

MorphX
When customization requirements are beyond the basics of IntelliMorph, the next tool of choice is MorphX. Use MorphX to fulfill customization requirements, such as adding new fields to a report or form. The second chapter in this training focuses on MorphX development. In some cases, the customization may introduce new functionality into Microsoft Dynamics AX 2009, such as new or additional logic to process a sales order. Use X++ to create new or additional application logic.

X++
X++ is the development language Microsoft Dynamics AX 2009 is built upon. This course does not go into detail on the X++ environment. There are other training offerings available to learn more about X++.

1-28

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture

Lab 1.2 - Moving a Column


Using Intellimorph to move a field in the Customers Form. Scenario A user has identified a need to have the field Customer Group as the first field in the overview display of the Customers Form.

Challenge Yourself!
Using Intellimorph, move the Customer Group column to its new location for the user in the Customer form.

Need a Little Help?


Use the Drag and Drop ability of Intellimorph to move the column from its current location to its new location.

Step by Step
1. Open the Customer Form. 2. Left-click and hold on the column heading for the Customer Group column. 3. Drag the column heading to the first column position of the grid, and release the left-click.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-29

Development I in Microsoft Dynamics AX 2009

Security
Security Structure
Four items control security in Microsoft Dynamics AX 2009: License codes include the company's purchased features. These license codes enable the whole company access to those areas purchased Configuration keys are used to enable or disable features in the application. These keys control access for the whole company Security keys are assigned to user groups and control access to features within Microsoft Dynamics AX 2009 at a user group level Record level security controls access to records in tables. This means that different user groups can have different access to different records in the same table

License Codes
The first step of configuring Microsoft Dynamics AX 2009 is purchasing and entering license codes into the system. License codes are installed in the Microsoft Dynamics AX 2009 Administration module. Development access is divided into four different licenses: Base Package MorphX Web MorphX X++

Base Package
The Base Package license gives access for creating or modifying reports, jobs, and queries. With the Base Package, the AOT displays the following nodes: Macros Reports Queries Jobs Menus Menu Items System documentation Application Developer Documentation Application documentation

1-30

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


MorphX
The MorphX license provides access to the Data Dictionary node, where tables, Fields, Enum, and Extended Data Types are maintained. The ability to create or modify forms and or Web forms requires the MorphX security package. With the MorphX license, the AOT displays the following nodes in addition to all the Base Package items: Data Dictionary Forms Extended Data Types Macros Jobs Queries Jobs Menus and Menu Items Help Documentation

In addition, the Web MorphX license provides access to Microsoft Dynamics AX 2009: Web Projects Web forms Web Page Style Sheet Editor

X++
The X++ license gives access to all classes in Microsoft Dynamics AX 2009 and a development code for the customer layer. It enables customers to put modified objects in the CUS layer, the USR layer, or both. The X++ license is used to modify standard routines, such as the invoice routine or the posting process for a ledger journal. It can also be used to create new business logic if functionality needs to be added to the application.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-31

Development I in Microsoft Dynamics AX 2009


Configuration Keys
Configuration keys in Microsoft Dynamics AX 2009 control the functionality and features in the system. These keys make sure that the Microsoft Dynamics AX 2009 solution is not cluttered with functionality companies do not use. Configuration keys have descriptions to describe the functionality affected by enabling or disabling them.

FIGURE 1.25 ACCESSING CONFIGURATION KEYS

Each configuration key controls access to a specific feature, and as soon as it is enabled or disabled, the feature is automatically added or removed in the database and in the user interface. The license code determines which configuration keys are available. If the license code for a certain module is not known, the corresponding configuration key does not appear in the list.

1-32

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


A feature can be removed or added by selecting the configuration key. For example, if a company does not use payment schedule, remove this feature by clearing the child configuration key Payment schedule located under the parent configuration key General ledger.

FIGURE 1.26 CLEARING A CONFIGURATION KEY

Working with Companies


The Microsoft Dynamics AX 2009 database can hold information for many different companies. Companies can be thought of as different business entities within Microsoft Dynamics AX 2009. MorphX allows each company to have its own set of data, while all are using the same application logic. Some of the tables in the application may contain information that can be reused by several companies. When working with companies in Microsoft Dynamics AX 2009, MorphX uses the following concepts: Table Collection - A specification of a list of table names. Each table in the system only occurs once in any one-table collection, but a table can be added to more than one table collection. There is no table data stored in a table collection. Data is stored in a virtual company or in a company Virtual company - Uses table collections that contain tables that are shared by all companies. It is recommended that these shared tables contain only fairly static data such as items, customers, zip codes, and more. The individual standard companies will have their own set of tables except for the shared ones in the virtual company Company - These are based on one or more virtual companies. When adding data to a table that is not in a virtual company, the data is stored directly in the company

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-33

Development I in Microsoft Dynamics AX 2009


Understanding Companies within the Database
Here is how Microsoft Dynamics AX 2009 stores data using companies, virtual companies, and table collections in a Microsoft SQL Server database. The illustration below shows a few things:

FIGURE 1.27 VIRTUAL COMPANY CONFIGURATION

The virtual company called VLC includes the companies LAU and DMO The corresponding data in the database is identified as belonging to the VLC virtual company in the field DATAAREAID The table collection included in the virtual company is identified as COA or chart of accounts

Security Keys
Security keys are set by User Group and determine the features specific users, as members of those groups, can access. Users can be denied or granted access to complete modules or to specific forms and fields. Security keys are maintained in the Microsoft Dynamics AX 2009 Administration module in the user group permissions form, under the Permissions button on the Permissions tab.

FIGURE 1.28 SECURITY KEYS

1-34

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


The Permissions tab contains the security keys for specific groups. Notice that most security keys are divided into eight categories: Daily Journals Inquiries Reports Periodic Setup Miscellaneous Tables

FIGURE 1.29 SECURITY KEY CATEGORIES

Properties within these categories can be set to: No access View Edit Create Full control

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-35

Development I in Microsoft Dynamics AX 2009


Security Hierarchy
License codes, configuration keys, and security keys are dependent on each other to control the features available in Microsoft Dynamics AX 2009. The hierarchy begins with license codes, configuration keys, and the most detailed level - security keys. A license code must be available to enable a configuration key. The configuration key must be enabled to allow it to be part of a security key. For example, to use the Project series, a license must be purchased and installed in Microsoft Dynamics AX 2009. After this is completed, the configuration key is available to enable the features available in the Project module. After enabling features in the configuration key, the more detailed features can be enabled or disabled using security keys. There cannot be a combination of conflicting configuration keys and security keys. The configuration or security key does not enable features to be available in the system if a license is not available.

Inquiry and Reports


Reports
Reporting is an important part of an ERP system. There is a variety of flexible reporting facilities built into Microsoft Dynamics AX 2009. There are four levels of reporting and customization of reports that range from easy to access predefined standard reports to completely customized reports using the AOT. Companies with specific reporting needs can redesign standard reports or develop new reports using the AOT. Refer to the third chapter in this course titled Report Adjustments to learn more about how to create custom reports. This manual expands on the capabilities of the Microsoft Dynamics AX 2009 reporting tool that includes report design, adjustments, and best practices.

Standard Reports
Standard reports in Microsoft Dynamics AX 2009 contain predefined tables, fields, and layouts. Do not change the table that is used or the fields displayed; however, ranges and sorting can be specified for all fields in the predefined tables.

1-36

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


There are several standard reports in the Reports folder in each module. These standard reports cover the reporting needs of most companies.

FIGURE 1.30 STANDARD REPORTS

Auto Reports
Auto reports are more flexible than standard reports. In addition to ranges and sorting, there is the ability to: Select which fields to print Define report layouts Define the summation of fields Define criteria for the fields

This figure illustrates the print dialog when creating an auto report.

FIGURE 1.31 CREATING AN AUTO REPORT

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-37

Development I in Microsoft Dynamics AX 2009


Start auto reports from any form in Microsoft Dynamics AX 2009 by clicking the Printer icon on the toolbar.

FIGURE 1.32 MICROSOFT DYNAMICS AX 2009 TOOLBAR

Simple Inquiry
Opening a standard report or auto report causes the print dialog to appear. The name of the dialog depends on the report. From this print dialog, change the range and sorting by clicking the Select button in the upper-right corner.

FIGURE 1.33 SELECT BUTTON ON THE AUTOREPORT FORM

1-38

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


When clicking the Select button, the Inquiry window displays as illustrated in the following figure.

FIGURE 1.34 INQUIRY FORM

This form is divided into three sections: Use the top part of the Inquiry window to select, save, and delete queries Use the center part of the Inquiry window to select which table or tables to use in a report Use the bottom part of the Inquiry window to select range, sorting, and print options

A simple inquiry might involve making changes to the field criteria.

Demonstration: Creating a Simple Inquiry on an AutoReport


1. Click the Print icon when viewing the Customer form. 2. Click Select on the print dialog box. 3. If Customer Group is not a field available in the bottom part of the inquiry, add this field.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-39

Development I in Microsoft Dynamics AX 2009


4. Set the criteria of this to only select customers in group 20. o If the criteria for customer group 20 are not listed in the criteria column, add it by selecting the list in the criteria column or by entering the new criteria into the text box of the criteria column for the customer group o The form should like the following illustration

FIGURE 1.35 INQUIRY FORM EXAMPLE

Make sure the print medium is set to Screen

NOTE: Change the print options from the print dialog screen by clicking the Options button. 5. Click OK.

Advanced Inquiry
Advanced Inquiries involve adding additional tables to reports and creating advanced ranges and sorts on fields in the additional tables.

1-40

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture


Demonstration: Adding a Table in an Advanced Inquiry
To obtain a list of customers outside the United States, add a one to multiple relationships to the Customer Invoice Journal table and add new criteria where the country for delivery is not equal to U.S. 1. Right-click the table that needs to be joined to another table and select a one to multiple relationship (1:n) or a multiple to one relationship (n:1). a. Select from all tables related to the original table.

FIGURE 1.36 INQUIRY FORM DEMONSTRATION

2. Add another row to the bottom part of the inquiry window. 3. Add criteria based on fields in the new tables.

Best Practices
The Developers Best Practice Handbook can be found on MSDN and contains information on the standards, rules, and guidelines that make up the best practices that are used in the development of the Microsoft Dynamics AX 2009 standard application.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-41

Development I in Microsoft Dynamics AX 2009


Use the handbook to better understand the Microsoft Dynamics AX 2009 standard application and to develop customizations and new solutions in the spirit of the Microsoft Dynamics AX 2009 standard application. Throughout the rest of this manual, there will be suggested best practices to perform while developing. These will be denoted as follows: BEST PRACTICE: Best Practices are found throughout the training manual and are preceded by the words BEST PRACTICE in bold.

1-42

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture

Lab 2.3 - Creating a Simple Inquiry on an Auto-Report


A simple inquiry might involve making changes to the field criteria. Scenario Generate an Auto-Report of the Customers table for only those customers that are in customer group 20.

Challenge Yourself!
From the Customers Form, use the Auto-Report functionality to generate a report for customers that are in customer group 20.

Need a Little Help?


From the Customers Form, use the Auto-Report functionality to generate a report. Use the selection criteria of the Auto-Report to select only customers that are in customer group 20.

Step by Step
1. Click the Print icon while viewing the Customer form. 2. Click Select on the print dialog. 3. If Customer Group is not a field available in the bottom portion of the inquiry, add this field. 4. Set the criteria of this to only select customers in group 20. If the criteria for customer group 20 are not currently listed in the criteria column, criteria can be added by selecting the list box in the criteria column or just enter the new criteria into the text box of the criteria column for the customer group.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-43

Development I in Microsoft Dynamics AX 2009


The form should look like the following figure:

FIGURE 1.37 SELECTION CRITERIA

Make sure that the print medium is set to Screen. NOTE: Change the print options from the print dialog screen by clicking the Options button. 5. Click OK.

Summary
This course discussed on a high level, the architecture behind Microsoft Dynamics AX 2009. It introduced important terms regarding the element of Microsoft Dynamics AX 2009 Development, and also looked at the user interface and different ways of having data presented in forms and reports. This course also discussed the basic security architecture that includes License codes, configuration keys, security keys and user groups. The next course examines the Microsoft Dynamics AX 2009 Data Dictionary and related topics.

1-44

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture

Test Your Knowledge


Test your knowledge with the following questions. 1. Where should the Business logic be executed with correctly designed objects? ( ) The Client ( ) The Application Object Server ( ) The Database Server ( ) Stored Procedures on the SQL Server 2. What three items control security within Microsoft Dynamics AX 2009? ( ) Security Keys, Domains and Companies ( ) User Group Permissions, Security Keys, and Layers ( ) License Keys, Configuration Keys and Security Keys ( ) Base Package Keys, X++ Keys, and MorphX Keys 3. Label file ID's that should not be used due to the risk of being overwritten when applying service packs include: ( ) SYS, MBS, USR ( ) SYS, LOS, DIS ( ) GLP, HFX, SL1, SYS ( ) SYP, LOP, DIP, SLP

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-45

Development I in Microsoft Dynamics AX 2009

Quick Interaction: Lessons Learned


Take a moment and write down three key points you have learned from this chapter: 1.

2.

3.

1-46

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 1: Microsoft Dynamics AX 2009 Architecture

Solutions
Test Your Knowledge
1. Where should the Business logic be executed with correctly designed objects? ( ) The Client () The Application Object Server ( ) The Database Server ( ) Stored Procedures on the SQL Server 2. What three items control security within Microsoft Dynamics AX 2009? ( ) Security Keys, Domains and Companies ( ) User Group Permissions, Security Keys, and Layers () License Keys, Configuration Keys and Security Keys ( ) Base Package Keys, X++ Keys, and MorphX Keys 3. Label file ID's that should not be used due to the risk of being overwritten when applying service packs include: ( ) SYS, MBS, USR ( ) SYS, LOS, DIS () GLP, HFX, SL1, SYS ( ) SYP, LOP, DIP, SLP

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

1-47

Development I in Microsoft Dynamics AX 2009

1-48

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

CHAPTER 2: DATA DICTIONARY


Objectives
The objectives are: Understand the MorphX development environment and the Application Object Tree (AOT) Design tables using MorphX Create and use tables using MorphX Understand relations on Microsoft Dynamics AX 2009 tables Understand the different data types within Microsoft Dynamics AX 2009 Learn how to create and modify Enumerated data types Understand the use of maps in MorphX Learn how to create and modify views using MorphX Learn how to create and modify indices using MorphX

Introduction
This chapter introduces the tools and procedures for creating tables, data types, and relations that are required to build the foundation for a simple Customer Birthday module in Microsoft Dynamics AX 2009. In Microsoft Dynamics AX 2009 this is accomplished from the Application Object Tree.

MorphX and the Application Object Tree


The Application Object Tree (AOT) is a tree view of all application objects in Microsoft Dynamics AX 2009. Each branch node contains a different application object type. Within the AOT, a developer can create or modify Microsoft Dynamics AX 2009 application objects using drag-and-drop functionality. The system has default settings for all application object properties. This chapter focuses on those objects contained in the Data Dictionary node. It briefly discusses all the objects within the data dictionary. The rest of the application objects are discussed in later chapters. The course goes into much more detail later in the chapter with tables, maps, views, extended data types, and base enums. First, it is important to know how to use the AOT.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-1

Development I in Microsoft Dynamics AX 2009


Procedure: Opening the AOT
Access the AOT from the Microsoft Dynamics AX 2009 application. There are three different ways to open the AOT. Navigate to FILE MENU > OPEN > APPLICATION OBJECT TREE.

FIGURE 2.1 OPENING THE AOT

Click the AOT icon on the application toolbar.

FIGURE 2.2 APPLICATION OBJECT TREE ICON

Press CTRL + D.

Features of the AOT


AOT Toolbar The toolbar located in the AOT contains five icons.

2-2

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


The functions of these icons are as follows: Press CTRL + O - This opens the application object directly from the AOT. Press F7 to Compile the object to locate syntax errors. Press ALT + ENTER to view the properties for the selected object. Click CTRL + SHIFT + S to save changes. Click the Import icon to import an .xpo file.

NOTE: Microsoft Dynamics AX 2009 objects are exported as .xpo files. These are the only types of files Microsoft Dynamics AX 2009 recognizes when trying to import into the AOT. AOT Right-Click Menu The right-click menu in the AOT differs slightly depending on the node. This section illustrates all the functions of the right-click menu on the top level of the AOT, excluding the Data Dictionary. This figure illustrates a right-click menu on the Tables node. NOTE: The Open New Window command makes it possible to have more than one instance of the AOT open at a time. This makes it simpler to work with multiple objects within the MorphX environment.

Objects in the Data Dictionary


This section focuses on the application objects located in the Data Dictionary node of the AOT. The other objects in the AOT are discussed in later sections in this course. Here is a list of all the objects in the Data Dictionary:

FIGURE 2.3 AOT OBJECTS

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-3

Development I in Microsoft Dynamics AX 2009


Tables - Tables store data in the system. They are organized in fields. These are assigned to different data types, depending on the type of data they hold. Data is entered, edited, and deleted through forms. Tables are discussed in more detail later in the section. Maps - Maps link one key value with another value. This can be any valid X++ data type. Maps are frequently used to link tables. By creating a map, fields can be accessed in different tables if the fields are of similar types but have different names. For example, a class that implements functionality to process data in the tables. If these tables use identical names for the columns, you can reuse data processing classes. Views - Views are read only data representations that combine multiple table objects. Views present a selected set of rows and columns by joining different tables through data sources and relations between them. Frequently views represent a subset of fields from a single table to simplify reporting. Extended Data Types - Extended data types are customized data types. They are based on the primitive MorphX data types. These include strings, integers, reals, dates, times, enums, or containers. The customizations modify system-defined behavior of primitive data types. Base Enums - Base enums are a list of literals. They can be used throughout the development environment in MorphX. Enums (enumerable type) are an extended data type that inherits from a base enum. The elements in an enumerable type are created by using the AOT, where the name of the type and the literals can be described in the definition. Security Keys, Configuration Keys, and License Codes are all part of the Microsoft Dynamics AX 2009 Security System. o Configuration Keys disable features in the application for all users, and control user group access to specific features within the system. Each key controls access to a specific feature, and as soon as it is disabled, the feature is automatically removed from the user view. In most cases, configuration keys are controlled by a License Code. When a license code is purchased, the family, the parent configuration key the license code controls, cannot be disabled. Security Keys restrict access to features for individual user groups. Although a feature is available in the Microsoft Dynamics AX 2009 system, some users are given partial or no access to the feature. Access to a feature is controlled by selecting No Access, View, Edit, Create, or Full control.

2-4

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Table Collections - Table collections do not contain any data. Virtual companies are built on table collections. They contain tables shared by more than one company. A table can be a part of more than one table collection. Perspectives - Perspectives organize tables, folders, fields, and roles, in subsets according to application modules in an intuitive way, matching the same concept as Microsoft SQL Server Reporting Services. Perspectives are also discussed in more detail with the use of OLAP cubes.

Tables
The Microsoft Dynamics AX 2009 database created during installation contains the complete repository. Tables are at the core of the Microsoft Dynamics AX 2009 application and enable storing a company's information and transactions.

Understanding Microsoft Dynamics AX 2009 Tables


Tables storing data about company transactions, inventory, general ledger, journals and more, form the base of the Microsoft Dynamics AX 2009 application. These are referred to as base tables or application tables. Some frequently used base tables are shown as follows. AX 2009 Table Name CustTable VendTable LedgerTable InventTable PurchTable Application Data Detail The parent table for basic customer information The parent table for basic vendor information The parent table for the general ledger that contains the chart of accounts information The parent table for the general inventory catalog The parent table for purchase order creation information

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-5

Development I in Microsoft Dynamics AX 2009

FIGURE 2.4 BASE TABLES

Other tables in Microsoft Dynamics AX 2009 contain metadata. These tables contain descriptions of data. This is not data found in a business transaction or business entity such as the ledger table. Metadata is housed in system tables. System tables are differentiated from application tables by the Sys prefix that starts the name of the table. Examples of system and application tables are shown in the following figure.

FIGURE 2.5 SYSTEM TABLES

Microsoft Dynamics AX 2009 Table Structure and Components


Tables in Microsoft Dynamics AX 2009 contain multiple elements that define the table. There are six categories that define tables: Fields Field Groups

2-6

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Indexes Relations Delete Actions Methods

This figure illustrates these elements:

FIGURE 2.6 TABLE CATEGORIES

Fields
Access the Fields node using MorphX to create or modify the physical columns in the database table. The fields that are defined within the Fields node are the columns belonging to the physical table named CustTable. CAUTION: Any fields created, deleted, or modified using MorphX in the Table node are reflected in the database. This can potentially damage the Microsoft Dynamics AX 2009 application if not used correctly. Display all the fields for the CustTable by opening the Fields node. The figure below illustrates how MorphX allows for direct viewing of all the columns within a Microsoft Dynamics AX 2009 table.

FIGURE 2.7 FIELDS IN THE CUST TABLE

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-7

Development I in Microsoft Dynamics AX 2009


Field Groups
Field groups in Microsoft Dynamics AX 2009 are logical groupings of physical database fields. Microsoft Dynamics AX 2009 uses Field Groups to cluster fields into logical groups so that these groups can be used with other Microsoft Dynamics AX 2009 objects, such as forms and reports. An example of such a group is the group Address located within the Address field group of the CustTable. NOTE: If a modification is made to a field group, related objects are automatically updated to reflect the new content of the group. Remember that IntelliMorph adjusts the layout of forms and reports which use the modified field group. Adding new fields to a field group can be a powerful technique for updating forms that use field groups with a new field. The CustTable has seventeen Field Groups. Two of the groups are used for automatic tasking such as Auto Reporting and Auto Lookup.

FIGURE 2.8 FIELD GROUPS IN THE CUSTTABLE

It is a best practice to use standardized names when field groups are created. These names include the following: Identification Administration Address <module name> (for example Ledger) Setup Dimension Misc

2-8

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


The Field groups can be viewed in the preceding figure. By expanding the Address field group as shown in the following figure, notice the fields that are grouped together. The six fields circled form the address group. Grouping them together as a single object helps in development efforts.

FIGURE 2.9 FIELD GROUPS IN THE CUSTTABLE

BEST PRACTICES: Define a group when several fields logically belong together and are shown together on forms and reports. Any field that appears in the user interface should belong to a group. The field group named Misc can be used for this purpose. This means that field groups can always be used to design forms.

Indexes
The indexes in the Microsoft Dynamics AX 2009 table definition are the physical indexes that exist on the tables in the database. Indexes speed searching capability and are discussed in more detail later in this chapter. There are two types of indexes: Unique Non-Unique

If a unique index is created based on a column (or a set of columns), Microsoft Dynamics AX 2009 makes sure that no duplicate keys occur in that column (or set of columns). Non-unique, or cluster indexes, are created for performance reasons. They provide a quick way of retrieving data, instead of performing a full-table search of all the records in the table. BEST PRACTICE: Use the suffix Idx when naming indexes.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-9

Development I in Microsoft Dynamics AX 2009


Relations
Microsoft Dynamics AX 2009 can create relationships between tables using MorphX. These relations are defined within the Microsoft Dynamics AX 2009 application and not at the physical database level. Relations govern the relationships between data in different tables and extended data types, such as foreign key relationships. Foreign key relationships between tables are always formed from the parent table. Form the relationship starting with the subordinate table; it is not necessary to go back to the parent table.

FIGURE 2.10 FOREIGN KEY RELATION

Under the relations node you can create different types of relationships between the parent table and other tables in Microsoft Dynamics AX 2009. The following figure shows the different types of relationships that exist for CustTable. There are nodes for a variety of different Relations such as BankAccounts and State.

Delete Actions
Microsoft Dynamics AX 2009 uses a category of methods called Delete Actions to govern how data is handled when a deletion event occurs in a parent table. There are four types of delete actions: None - The row in this table is deleted but nothing occurs to the tables that relate to this table. Cascade - The row in this table is deleted and all data in relating tables is also deleted.

2-10

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Restricted - The row in this table is only deleted if there is nothing that relates to it. Cascade + Restricted - Cascade delete even though records exist on related tables. A warning appears; if clicking No nothing occurs; if clicking Yes the cascade deletion runs.

NOTE: Exercise caution when setting up delete actions, as misuse may cause orphaned records.

Methods
Microsoft Dynamics AX 2009 uses methods within the table node to perform a variety of functions such as contact person and currency name lookup. In addition, Microsoft Dynamics AX 2009 uses methods to find open orders and other tasks. Methods are coded using X++. The methods may be modified using MorphX to provide custom functionality.

Creating Tables
Existing tables in Microsoft Dynamics AX 2009 can be modified or new tables may be created using the MorphX tools in the AOT.

Procedure: Creating a Table in Microsoft Dynamics AX 2009


There is a specific sequence for the successful creation of a new table. The steps are as follows: 1. Create a table. 2. Create extended data types. 3. Add fields to the table. a. Drag relevant extended data types to the Fields node of the relevant table. 4. Create relations on extended data types. 5. Create indexes. Each of these steps contains sub steps that are demonstrated in the following sections. NOTE: Microsoft Dynamics AX 2009 has a Version Control System; if this is enabled, the procedure differs from what is described here.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-11

Development I in Microsoft Dynamics AX 2009


Demonstration: Creating a Table
The structure of this table includes the birthdays of customers, their account numbers, and any gift ideas that might be suited for them. Right-click the Tables node in the Data Dictionary in the AOT and select New Table.

FIGURE 2.11 SELECTING NEW TABLE

2. Rename the table by right-clicking on the table and selecting Rename from the right-click menu. 3. Name the table CustBirthday.Expand the node of the CustBirthday table and view all the categories discussed previously.

FIGURE 2.12 CUSTBIRTHDAY CATEGORIES

2-12

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


4. Add the appropriate fields to this table. 5. To add new fields, right-click the Fields node and select New from the right-click menu; then select from one of the primitive data types for creating the new field. a. In this case, use the data type of Date for the birthday field.

FIGURE 2.13 SELECTING DATE FOR A FIELD

b. Rename this field by right-clicking and selecting Rename from the right-click menu and typing birthday. 6. Repeat this process to create two more fields: Enum field: GiftIdeas String field: AccountNumber 7. Figure below illustrates the completed table:

FIGURE 2.14 THE COMPLETED TABLE

a. Save the table. NOTE: Microsoft Dynamics AX 2009 synchronizes the table when Saving. Synchronizing a table automatically creates or updates it into the underlying database.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-13

Development I in Microsoft Dynamics AX 2009


Another way to synchronize is by selecting the Synchronize entry from the rightclick menu on the table.

FIGURE 2.15 SELECTING SYNCHRONIZE

Table Tools The Add-Ins Submenu


Microsoft Dynamics AX 2009 offers many types of support when working with the MorphX environment. One kind of support can be found by right-clicking the object and selecting Add-ins. Some of these commands are also available on the Tools menu's Development submenu. The difference between using commands from the Development menu and using commands from the Add-ins menu is that the commands in the shortcut menu take the current node as the object to apply the actions taken. Here are some of the available options in the Add-ins Submenu: Cross reference - Contains facts about the object, where it is used, and relations to other objects. Application objects - Displays general, date, and version information about the current application object. Developer Documentation - Contains documentation for the developer. Table definitions - Generates a report presenting an overview of the current table fields, types, labels, configuration keys, and help texts. Table Browser - Displays the contents of a table. From the Table Browser, write SQL scripts and insert data directly into a table. This is explained in the next section.

2-14

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Auto Report - Creates a report that uses information in the AutoReport field group on the current table object. Code Explorer - Views code in a Help window and eases navigation within application object components, code view can display either X++ source code, or the contents of a property sheet and a list of child nodes. The Application Hierarchy Tree - Displays the current object's inheritance hierarchy. Compare - Compares the current object with another object, or another version of the same object. Code upgrade - Used when upgrading Microsoft Dynamics AX 2009, the code upgrade window displays methods in bold that conflict between versions. Find and replace - Used to find/replace text in the X++ code on the current object, including its children. Syntactic renaming - Makes a qualified find and replace in the X++ source code. Check Best Practices - Checks if the X++ code complies with Microsoft Dynamics AX 2009 standards.

Viewing and Searching Data in Microsoft Dynamics AX 2009 Tables


MorphX lets the user view data in Microsoft Dynamics AX 2009 tables using the Table Browser tool. The Table Browser operates from the Add-ins menu of MorphX and returns a record set to the user. NOTE: This option is only available with the purchase of the X++ source code module. Because this tool returns an updatable record set, the data within the table may be edited within the utility. This can be a very dangerous tool because data edited here alters the database. The Table browser also allows for sorting and searching of specific data.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-15

Development I in Microsoft Dynamics AX 2009

CAUTION: Improper use of the Table Browser tool may result in corrupted records that may render the company unusable. 1. Open the customer table CustTable and select Table Browser from the Add-Ins menu as shown in the following figure. After selecting the Table Browser, a form opens that contains data from the customer table. Notice that the SQL statement used to obtain the data appears in the lower part of the window as shown in the following figure. 2. Alter the SQL statement manually and re-query the data to change the display results. Also use the standard search options explained in an earlier course, if desired. To sort the data into an ordered manner, access the MorphX menu and select Sort Ascending or Sort Descending. The customer Name data is sorted in an ascending order for viewing purposes. To remove a filter or sort order, use Remove Filter/Sort from the MorphX menu or the toolbar. To view the customer form associated with the customer table, move the pointer into the first column of the table browser window and open the MorphX menu. Select Go to the Main Table Form. The customer form connected to the customer table appears as shown in the following figure. Now, the data within the customer table is successfully browsed and a search performed without leaving the MorphX environment.

2-16

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

Lab 2.1 - Table Creation


Create a Table that will store data for a list of Company Holidays

Challenge Yourself!
1. Create a New Table in Microsoft Dynamics AX 2009 named CompanyHolidays. 2. This table should contain three fields that have appropriate data types and labels: o Field 1: Name of holiday o Field 2: Date of holiday o Field 3: Day of week the holiday falls on NOTE: For this exercise, try to use pre-existing labels if it is possible using the Find Label dialog box. 3. Assign the following Extended Data Types to the appropriate fields: o DateDayName o DatePhysical 4. Name

Step by Step
Solution
Table Creation 1. To create the basic table named Company Holidays right-click the Table node in the AOT and select New Table. 2. After the Table is created, a new Table named Table1 displays. 3. Open the Fields branch and create the fields in the Table. Set up a correspondence for field name, field label, and description: Field Name HolidayName HolidayDate DayName Field Description Name of the Holiday Date of Holiday Name of the Day the Holiday is on Field Label Holiday Date of event Days

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-17

Development I in Microsoft Dynamics AX 2009


1. The correct primitive types to assign are as follows: a. HolidayName as String b. HolidayDate as Date c. DayName as String 2. To create the fields for the new Table use the MorphX menu field creation method. 3. Open the properties menu for the new field and set its Name and Label properties according to the instructions in the exercise. Remember to use the Find Label method with the keyword Holiday. If there are no appropriate labels then create a new one 4. Create the rest of the fields in the same manner. 5. Open the properties sheet for the new field and set its Name and Label properties. Locate the label using the Find Label method with the keyword Date of event. 6. Create the last field for the name of the day on which the holiday falls. 7. Set the Name and Label properties for the DayName field. 8. Set the Name and Label properties of the table to CompanyHolidays and Holidays respectively. 9. Synchronize and save the work.

Extended Data Types


The appropriate Extended Data Type assignments are as follows: DateDayName assigned to DayName field. DatePhysical assigned to HolidayDate field. Name assigned to HolidayName field.

1. To find the appropriate Extended Data Types listed above use the MorphX drop-down menu on the Extended Data Properties. 2. Repeat the process for all the fields.

2-18

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

Relations
Relations are a method that helps secure business rules to enforce existing properties between field values existing in different tables. This is known as referential integrity. There are many different kinds of referential integrity. A relation may be created on an Extended Data Type in the same manner it is created for a field existing in a table. Relations not only serve to enforce business rules in Microsoft Dynamics AX 2009, they are also used for other important tasks, such as: Creating auto joins in forms. Looking up values in other tables (using lookup list/selection list boxes and the Go to Main Table command). Validating data by providing constraints. Automatically propagate changes from one table to another by defining cascading relations. Generating ToolTips. Auto defining relations in queries.

The customer birthday is an example in which to enforce that only customer account numbers exist in the table, and that vendor numbers are not accidentally input into the customer birthday table. To prevent this, build a relationship between the CustBirthday table and the Microsoft Dynamics AX 2009 customer table named CustTable. This relationship enforces future input to the table and insures that only customers receive gifts.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-19

Development I in Microsoft Dynamics AX 2009


Demonstration: Creating a Relation on the CustBirthday Table
This demonstration shows the steps to follow when creating relations. 1. Expand the CustBirthday table node by right-clicking the Relations node and selecting New Relation.

FIGURE 2.16 EXPANDING A TABLE NODE

A framework for the new relation is created.

2. Open the properties sheet for the relation. 3. The Properties sheet shows three properties: Name, Table, and Validate.

FIGURE 2.17 RELATION PROPERTIES SHEET

4. Name the relation CustomerGifts. Verify that the Validate property is set to Yes. o The Validate property ensures that data in the parent table is checked according to the Relation being constructed.

2-20

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


5. The table to designate as the parent table for the Relation is the Microsoft Dynamics AX 2009 customer table named CustTable. Select the name of the table from the drop-down menu of the Table property.

FIGURE 2.18 SELECT CUSTTABLE

6. Close the Properties sheet, and then highlight the Relation, and right-click to access the right-click menu.

FIGURE 2.19 SELECTING A FIELD RELATIONSHIP

There are three types of field relationships that can be assigned. Normal relationships enforce referential integrity such as foreign keys. Field fixed works as a trigger to verify that a relation is active. If an enum field in the table has a specific value, then the relation is active. Related field fixed works as a filter on the related table. It only shows records that match a specified value for an enum field on the related table.

7. Create a normal relationship for CustomerGifts.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-21

Development I in Microsoft Dynamics AX 2009


8. This enforces the referential integrity constraint that the customer account number within the customer birthday table must exist in the customer table. The skeleton of the relation is created as shown in the figure below:

FIGURE 2.20 RELATION SKELETON

g. Open the Properties sheet of the relationship and define the field relations between the fields of the CustBirthday table and the table CustTable. The Field property refers to the assigning table (CustBirthday). The RelatedField property refers to the relating table (CustTable). The following figure shows the completed relationship between fields after closing the properties sheet.

FIGURE 2.21 COMPLETED RELATIONSHIPS

Data Types Primitive and Extended


Microsoft Dynamics AX 2009 has built in primitive and extended data types associated with the information in the database.

Primitive Data Types


The basic set of primitive data types in Microsoft Dynamics AX 2009 map to underlying data types that exist in the physical database. These primitive data types can be expanded to create Extended Data Types, which are reusable data types having a specific definition. The primitive data types enabled within Microsoft Dynamics AX 2009 are: String Integer

2-22

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Real Date Time UTCDateTime Enum Container GUID Int64 Boolean Field Description A number of characters. A number without a decimal point. 32 bits wide. A number with a decimal point. Contains day, month and year. Contains hours, minutes and seconds. A combination of Data and time types into one data type that also holds timezone information. A set of literals that may be represented internally as Integers A composite data type that is a dynamic list of items containing primative data types and/or some composite data types. Globally Unique Identifier. A 16-byte number generated that uniquely identifies a network or interface. A number without a decimal point. 64 bits wide. Only contains the values false and true.

Field Name String Integer Real Date Time UTCDateTime Enum Container

GUID

Int64 Boolean

Extended Data Types


Extended Data types can inherit either from primitive data types or other Extended Data Types, which enables properties to be inherited. The benefit of creating Extended Data Types is the reuse of its properties. For example, if a table field is created based on an Extended Data Type (EDT), the new field's element properties are automatically inherited from the EDT. Another benefit is more efficient maintenance. The properties of many fields can change at one time by changing the properties on the EDT.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-23

Development I in Microsoft Dynamics AX 2009


Some important facts about Extended Data Types are in the following list: Extended Data Types can be based on primitive MorphX data types or on another EDT. If it is possible, custom tables have fields based on Extended Data Types. A relation can be assigned to an Extended Data Type and it can be made a Related Field Fixed relation. Most fields in Microsoft Dynamics AX 2009 tables are based on Extended Data Types. After it is created it can be reused as many times as it is needed in the application. The creation of the Extended Data Type shown in the preceding figure is based on a String primitive Data Type. This Extended Data Type can be used anywhere within Microsoft Dynamics AX 2009 where a field requires the same properties.

Demonstration: Data Types


The following demonstration examines the properties of the AccountNumber field created in the CustBirthday table. Start by using the right-click menu to open the Properties page for the AccountNumber field. The Properties sheet is displayed after the method is selected. From the Properties sheet, the primitive data type assigned is a String and has a size of 10 by default. The ExtendedDataType property is not yet set. To view how these properties translate into a physical database data type, the following figure illustrates the design of the field from the database. This is the mapping given by Microsoft Dynamics AX 2009 for the AccountNumber field originally defined as a String. The field birthday with a primitive data type of type Date is translated as Date. However, the GiftIdeas field of type Enum has a non-intuitive translation. When primitive data types are incompatible with those supported by the database, Microsoft Dynamics AX 2009 extends its data type into an existing one. That is why the primitive data type Enum of the GiftIdeas field is mapped to an integer in the database. The Microsoft Dynamics AX 2009 Application Object Server (AOS) can use stored metadata to translate the Enum data type into a list of values presented to the user. After defining the customer gift ideas, they are stored in the database as integer values but appear on a form as a list of gift ideas.

2-24

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Demonstration: Creating an Extended Data Type
This demonstration examines a similar extended data type. First, explore the properties of the BirthDate extended data type by viewing the properties of this object.

FIGURE 2.22 EXTENDED DATATYPE BIRTHDATE PROPERTIES SHEET

It is clear from viewing the Properties sheet that Microsoft Dynamics AX 2009 developers have thought of an Extended Data Type for an employee's birthday; but an Extended Data Type for a customer's birthday does not exist. The Extended Data Type BirthDate is an example of basing an extended type on another extended type, because it is based on the Extended Data Type called TransDate. TransDate is also an Extended Data Type based on the primitive type of Date.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-25

Development I in Microsoft Dynamics AX 2009


The following procedure creates an extended data type for a customer's birthday. 1. Right-click the Extended Data Types node and select New. Assign the primitive data type of Date to this new Extended Data Type.

FIGURE 2.23 ASSIGNING A DATA TYPE TO THE NEW EXTENDED DATATYPE

2. Rename the new extended data type to Birthday. 3. Open the Properties sheet and find the property called Extends. For the new data type to inherit the behavior from the existing Extended Data Type BirthDate, select BirthDate from the drop-down menu.

FIGURE 2.24 SELECT THE EXTENDED DATA TYPE

2-26

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


4. Set the label property for the new Extended Data Type to Birthday.

FIGURE 2.25 SET THE LABEL

Now, a new Extended Data Type named Birthday is created that is based on the already existing Extended Data Type BirthDate.

5. Save the new Extended Data Type. o Assign this new Extended Data Type to the Birthday field on the CustBirthday table.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-27

Development I in Microsoft Dynamics AX 2009


6. Open the Properties sheet of the Birthday field on the CustBirthday table and set the Extended Data Type to Birthday as shown in the following figure.

FIGURE 2.26 SET THE DATA TYPE

NOTE: Assigning an Extended Data Type to a field on a table causes that field to inherit all the properties of the extended data type. Therefore, this Birthday field has the label Birthday. It is not necessary to assign a label to the field property. 7. Close the Extended Data Type branch, open the Tables branch, and synchronize the database by right-clicking on the Table and selecting Synchronize.

Understanding Extended Data Types


To understand the concept of an Extended Data Type, assign an Extended Data Type to the AccountNumber field created in the previous customer birthday table example. The AccountNumber field in the CustBirthday table can inherit the Account Number properties in the customer table. To create appropriate assignments, explore what data type the customer table uses for its account number field. Because the account number in the birthday table is the same field, assign the same Extended Data Type that exists for account numbers in the customer table to customers in our birthday table.

2-28

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Demonstration: Assigning an Existing Extended Data Type to a Field
This demonstration assigns an extended data type to a field. 1. Within the AOT, locate the customer table named CustTable. 2. Assign the properties of the account number found in the CustTable to the account number in the CustBirthday table. o The Extended Data Type of a field is a property on the field. To examine the properties of the AccountNum field, highlight the field and then click the Properties menu item to expose the Properties sheet.

FIGURE 2.27 PROPERTIES SHEET OF ACCOUNTNUM FIELD IN THE CUSTTABLE TABLE

The account number in the customer table has an Extended Data Type value named CustAccount. This is the same inheritance that needs to be passed along to the account number in the table that is created.

3. Expand the Fields node within the CustBirthday table. 4. View the properties sheet for the AccountNumber field. 5. Select CustAccount as the value for the Extended Data Type property from the drop-down list. 6. Save the modifications. The AccountNumber field in the customer birthday table is now assigned the CustAccount Extended Data Type.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-29

Development I in Microsoft Dynamics AX 2009

Base Enumerations (Base Enums)


Base enumerations are used as data lists for fields of the Enum type. Base enumerations, also named Base Enums, are used for assignment to Enum primitive data type fields that require a set of predefined values. The elements of a base enumeration are defined as string values and assigned an integer identifying value. As soon as constructed, the base enumeration may be assigned to any field that is defined as type Enum.

Base Enums
The base enumeration that describes the status of a customer and or vendor payment is shown in the following figure. The base enumeration defines the status of a customer or vendor payment and the values that can be selected. The status code of Received is shown with its identifying integer value of 5. The identifying integer value is never used for display purposes but serves as the unique Index for the string value of the element. Base enumerations or Base Enums are data types that enable list objects to be created within Microsoft Dynamics AX 2009. The list object is an indexed dropdown menu whose values are specified at design time. These lists can be used as cells within grid objects or as objects resigning independently on a form. Base Enums provide a choice of items from a defined list that may be assigned or modified. For example, a field designating the month that belongs to a transaction should contain twelve months and possibly a null designator. Microsoft Dynamics AX 2009 contains a Base Enum for this purpose.

2-30

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Expanding the Base Enums node opens the Base Enums in the Microsoft Dynamics AX 2009 application. The following figure illustrates an example of a Base Enum for the months of the Year, which is named MonthsOfYear.

FIGURE 2.28 BASE ENUM FOR MONTHSOFYEAR

Demonstration: Creating Base Enums


The following demonstration shows how to create a Base Enum for the field named GiftIdeas in the CustBirthday table. The rows of the CustBirthday table represent a customer's account number, birthday and an Enum data type field intended to house different gift ideas. 1. Right-click the Base Enums node in the AOT and select New Base Enum. o Literal values of a base enum in the AOT are called Elements. Add three elements to this Base Enum. 2. Rename the new Base Enum to GiftIdeas and give it a label of GiftIdeas.

FIGURE 2.29 GIFTIDEAS ENUM

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-31

Development I in Microsoft Dynamics AX 2009


3. To add elements to a Base Enum, right-click the created base enum and select New Element.

FIGURE 2.30 SELECT NEW ELEMENT

4. View the properties sheet for this element. 5. Set the Name of the element to Idea1 and the Label of the element to Ties. The Name represents a name given to the element on the AOT and its label value is the value presented in the user interface.

FIGURE 2.31 SET THE LABEL PROPERTY

6. Create two other elements: one named Idea2 with a label of Watches and the other named Idea3 with a label of Theater Tickets. o Notice how the value of the EnumValue property starts with the value of zero (0) and automatically increments itself by one (1) for every idea added. These EnumValues are how Microsoft Dynamics AX 2009 tracks in the database the enumerated properties being defined.Demonstration: Creating an Extended Data Type That Uses a BaseEnum Now that a base enumeration is created for different gift ideas, assign it an Extended Data Type. 1. Create a new Extended Data Type. 2. Open the Properties sheet for the new object created and give it a name of Gifts and a label Gifts.

2-32

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


3. Assign the EnumType property to the GiftIdeas Extended Data Type created earlier. o There is now an Extended Data Type based on the GiftIdeas Base Enum.

FIGURE 2.32 EXTENDED DATATYPE USING A BASEENUM

4. Save the work created and synchronize the object to the database. 5. Now assign the Gifts Extended Data Type to the GiftIdeas field in the customer birthday table. Open the Properties sheet for the GiftIdeas field and assign the ExtendedDataType property the value Gifts.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-33

Development I in Microsoft Dynamics AX 2009


6. After assigning the Extended Data Type the Enum Type property automatically fills in by clicking the Enum Type property value.

FIGURE 2.33 EXTENDED DATATYPE ASSIGNED TO THE FIELD GIFTIDEAS

7. Now, a new base enumeration is created and an Extended Data Type based on it. This new Extended Data Type is also assigned to a field in the customer birthday.

Maps
Maps define X++ elements that wrap table objects at run time. With a map, a map field is associated with a field in one or more tables. This enables to use the same field name to access fields with different names in different tables. Map methods enable to create or modify methods that act on the map fields. A table can be accessed through more than one map. Typically, if more than one map accesses the same table, each map accesses different subsets of fields in the table. Maps do not define database objects and so they are not synchronized with the database.

Maps
An example of a Map is the CustVendTable Map. This map has fields created from existing Extended Data Types. The fields are then mapped to physical data values that exist in Microsoft Dynamics AX 2009 tables through the Mappings node of the Maps branch.

2-34

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


This following figure shows some of the fields that are defined in the CustVendTable map.

FIGURE 2.34 CUSTVENDTABLE MAP

The mapping of these fields is performed in the Mapping node of the Map. The table nodes for the mapping are shown in the following figure. Explore some of the actual mappings that exist for the Map fields under the CustTable node. Open the Properties sheet of the AccountNum mapping to reveal its properties. The mapping creates a lookup between the Extended Data Type AccountNum in the CustTable and the AccountNum field that exists in the map. Creating the supporting logic and methods for a map is a subject addressed in a later course.

Views
A Microsoft Dynamics AX 2009 view is a virtual table that provides the data records and fields that are specified by a query. The following sections describe views and how they retrieve data. Like a table, a view uses fields and rows to represent data records. However, the data in a view is not stored as a database object but is dynamically created when the view is accessed. A view uses a query to retrieve data fields from one or more database tables.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-35

Development I in Microsoft Dynamics AX 2009


In Microsoft Dynamics AX 2009, use views where tables are used. For example, use a view in a form, a report, and in X++ code. The following table shows the benefits of using a view instead of a table. Benefit Focused Data Customized Data Description A view is used to retrieve and return only the data that is relevant for a particular user or scenario. A view enables the use of a complex query to create a highly-customized set of data. For example, a view often represents data as a single table that is retrieved from multiple joined tables and used many conditions. A view can improve performance by returning only relevant fields to the user. In addition, a view definition is compiled which may provide better performance than calling an equivalently complex query.

Performance

When a view is created, the view definition is generated and stored in the database. When that view is accessed, the view dynamically retrieves the data that satisfies the view definition. NOTE: Views are read-only. The data fields and tables that a view uses cannot be updated from that view. Views are synchronized like tables. When a view is synchronized, the view definition is saved to the database. Synchronization of an existing view causes the definition of that view to be dropped and re-created in the database.

Demonstration: Creating Views


This demonstration shows how to create a view. 1. Right-click the Views node and select New View. Name this view CustBirthdayView. 2. Expand the node for the new view to reveal the object categories associated with it.

FIGURE 2.35 EXPAND THE VIEW

2-36

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


o The Metadata branch contains the tables, relations, and constraints of the underlying SQL query that is used to form the View. The SQL query itself is formed from data sources. The Fields branch tells what fields are included in the View. Fields in a View inherit the data type from the fields in the Data Sources. The fields in a View are displayed as if they belonged to a Microsoft Dynamics AX 2009 table. There is an exception however that enables the data in a field to be displayed as an aggregated value. This depends on the data type of the field in the View. To perform aggregation on a field within a View the field must be a numeric field, because aggregation functions are not valid for a String, Date, or Enum data type.

3. To create a data source that can be used to construct a View, dragand-drop a data source from the tables node in the AOT. a. Right-click the Tables node in the AOT and select Open New Window. This opens a subset of the AOT that contains only Tables. b. Drag the CustBirthday table from the Tables node in the AOT to the Data Sources node within the Metadata of a View.

FIGURE 2.36 DRAG THE TABLE

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-37

Development I in Microsoft Dynamics AX 2009


4. Add a data source to the new data source CustBirthday. This new data source is the CustTable. Using the same technique, drag the CustTable onto the Data Source node of the CustBirthday data source.

FIGURE 2.37 DRAG THE CUSTTABLE

5. Create a relation between the data sources so that the data within each Data Source can be joined together. Right-click the relations node of the CustTable Data Source and select New Relation.

FIGURE 2.38 RELATIONS NODE

2-38

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


6. If a relation exists between the two data sources this relation is inherited automatically. Change this relation if it is required. Do this similar to creating relations in a table or extended data type. Add fields to the view by dragging fields from the Fields node of the Data Sources to the Fields node of the View.

FIGURE 2.39 ADD FIELDS

7.

Add fields to the view by dragging fields from the Fields node of the Data Sources to the Fields node of the View. o CustBirthday fields: AccountNumber, birthday, Giftideas o CustTable fields: Name, Address, City, State, and ZipCode

8. Perform the same set of actions until all fields are added. o A row of data has been created in the CustBirthday table. This is sufficient for testing of the new View. After closing the Table Browser, save the table so that the data synchronizes to the database.To test the CustBirthdayView, open the View in the Table Browser as we did with the CustBirthday table.Lab Views

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-39

Development I in Microsoft Dynamics AX 2009


9. Close the properties sheet and save the new View. o To test the new view, enter data into the CustBirthday table. To add data to the CustBirthday table, use the Table browser. Rightclick the CustBirthday table in the AOT and select ADDINSTABLE BROWSER. o A form displaying the rows and fields within the table appears.To enter data to the table, press CTRL + N and populate the row of the table that is made available. For the demonstration, select an AccountNumber of 4001, a birthday of March 11, 1967 and set Theater Tickets as the gift idea. o A row of data has been created in the CustBirthday table. This is sufficient for testing of the new View. After closing the Table Browser, save the table so that the data synchronizes to the database.To test the CustBirthdayView, open the View in the Table Browser as we did with the CustBirthday table.

2-40

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

Lab 2.2 - Views


Create a View that will join your new CompanyHoliday table to the Microsoft Dynamics AX 2009 WorkCalendarDate table

Challenge Yourself!
Create a View that will join your new CompanyHoliday table to the Microsoft Dynamics AX 2009 WorkCalendarDate table. From the CompanyHoliday table o o o HolidayName HolidayDate HolidayDayofWeek

From the WorkCalendarDate table o o WorkTimeControl TransDate

Need a Little Help?


1. Create a new view. 2. Add the appropriate data sources and create a relation between them. 3. Include the following fields in the View: o From the CompanyHoliday table o HolidayName o HolidayDate o HolidayDayofWeek o From the WorkCalendarDate table o WorkTimeControl o TransDate 4. Enter the following information into your CompanyHoliday table. o Holiday Name: Christmas o Holiday Date: 12/25/2006 o Name of the Holiday Day: Saturday 5. Test the view by opening it in a Table Browser. o This should return a table that contains five columns, one for each field in the view, and the WorkTimeControl field should display Closed.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-41

Development I in Microsoft Dynamics AX 2009


Step by Step
Solution
1. Constructing the CompanyHoliday View is accomplished by creating a new View. 2. Create two Data Sources for the new View. 3. Open the Properties sheet of the first Data Source created and set its Table Properties. 4. When opening the Properties sheet change the Table Properties only. The Name property is automatically set from the Table name. 5. Create the other Data Source for the view by opening the branches of the first Data Source. The empty Data Source node is below the first created Data Source. 6. Open the Properties sheet for the second Data Source and set its Table property to WorkCalendarDate table. 7. Set up a Relation between the Transaction Date field (named TransDate) in the WorkCalendarDate table and the HolidayDate field in the CompanyHolidays table. Create the new Relation using the Relations node found in the very last Data Source. 8. Open the Properties sheet of the newly created Relation. 9. Set the Field property and Related Field property, where TransDate field is equal to the HolidayDate field. 10. Drag all the relevant fields from the first Data Source into the Fields branch of the View. 11. Use the same procedure for the WorkCalendarDate Data Source that was the second Data Source created. 12. Set the Name property of the View to CompanyHoliday. 13. Save your work using the MorphX menu. 14. Test the new View by opening it with the Table browser. 15. If the View is correctly constructed it should show: a. TransDate b. WorkTimeControl c. HolidayName d. DayName e. HolidayDate

2-42

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

Indices
Indices in databases have the same purpose as in a printed book although they are made in another way. An index for a book is a guide to the pages in the book, whereas an index for a table in a database provides a reference to a record or a set of records. There are two types of Indices: unique and non-unique. If a unique index is created based on a certain column, Microsoft Dynamics AX 2009 makes sure that no duplicate key values occur in that column. In the same manner, updates on a column that contain a unique index, which violates the uniqueness of the column, cause an error. Non-unique Indices are created for performance reasons. They provide a quick way of retrieving data, instead of performing a full-table search of all the records in a table. Do not create an indefinite number of Indices because they use system space and must be updated every time system data is created, edited, or deleted. This can slow down the updating process. When an Index is created, it is recommended to give the Index a name reflecting the names of the related fields, followed by the suffix IDX.

Creating Indices
Creating an Index in Microsoft Dynamics AX 2009 always relates to the table where it is created. The Index can only be created on fields that exist in the table. These Indices may be unique or non-unique, and are based on either a single column or multiple columns that exist within the table. NOTE: A field of data type memo or container cannot be used in an index.

NOTE: Microsoft Dynamics AX 2009 requires a unique index on each table so if there are no indexes on a table or all the indexes are disabled, a system index is automatically created. The system index is created on the RecId and DataAreaId fields if the DataAreaId field exists. Otherwise the system index is created on the RecId field. System indexes can be seen in the database but they are not visible in the AOT.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-43

Development I in Microsoft Dynamics AX 2009


Demonstration: Creating an Index
Create an Index on the CustBirthday table. If information is known about whether the company acquired theater tickets in a promotion, then it is possible to do a quick search on those customers who have theater tickets listed as their gift idea, and to reserve those tickets for them. 1. Expand the Tables branch of the AOT, locate the CustBirthday table and reveal the Indexes branch. Right-click the Indexes node and select New Index. Rename this to birthdayidx. 2. Set the AllowDuplicates property to Yes and the Enabled property to Yes.

FIGURE 2.40 ALLOWDUPLICATES PROPERTY

3. Add the GiftIdeas to the index, using the drag-and-drop. Expand the Fields node and drag the GiftIdeas field to the birthdayidx index. o The Index for the CustBirthday based on the field GiftIdeas is now complete and appears on the following AOT.

FIGURE 2.41 GIFTIDEAS INDEX

2-44

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Primary Index
A primary key is one or more columns that uniquely identifies one record in a table from all the other records. A Primary Index is a unique index for a table that defines the primary key for that table. To set an index as a unique index, set the index property Allow Duplicates to No. A typical example of the primary key is the CustTable where the customer's AccountNum is used as a primary key. This primary key is used as the Primary Index for the CustTable table.

FIGURE 2.42 ACCOUNTIDX AS THE PRIMARY INDEX FOR CUSTTABLE

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-45

Development I in Microsoft Dynamics AX 2009

Lab 2.3 - Indices


Create an Index that is a unique index of the new CompanyHoliday table on the field HolidayDate. Set the new unique index as the Primary Index on the CompanyHoliday table.

Challenge Yourself!
Create an Index called HolidayDateIdx that will be a Primary Index for the CompanyHoliday table on the field HolidayDate. Set the Primary Index property on the CompanyHoliday table to be the new index HolidayDateIdx.

Step by Step
1. With the CompanyHoliday table open in the AOT, reveal the Indexes branch. Right-click the Indexes node and then select New Index. Rename this to HolidayDateIdx. 2. Set the AllowDuplicates property to No and the Enabled property to Yes. 3. Add the HolidayDate to the index, using the drag-and-drop. Expand the Fields node and drag the HolidayDate field to the HolidayDateIdx index. a. The Index for the CompanyHoliday based on the field HolidayDate is now complete. 4. Select the CompanyHoliday table, right click and select synchronize from the menu. 5. Open the properties for the CompanyHoliday table, and set the property Primary Index to HolidayDateIdx. a. The Primary Index for CompanyHoliday is now complete.

Summary
This chapter discussed the Microsoft Dynamics AX 2009 Data Dictionary and the related objects in the AOT. This chapter also introduced the tools and procedures for creating tables, data types, and relations that are required to build the foundation of any table in Microsoft Dynamics AX 2009. The next chapter examines the User Interfaces in Microsoft Dynamics AX 2009 such as Forms, Menus, and other non-graphical objects.

2-46

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

Test Your Knowledge


Test your knowledge with the following questions. 1. Task: Put the following steps in order to create a new Primary Index in a table. Step _____ : Add the primary key field(s) to the index Step _____ : Set the Allow Duplicates property on the index to No Step _____ : Set the Primary Index on the Table to the Unique Index Step _____ : Create a new index Step _____ : Set the name for the new index Step _____ : Synchronize the AOT 2. Allowable data types for an index may include: ( ) String, Integer, Real, and Container ( ) String, Enumerated, Real, and Memo ( ) String, Integer, Real, and Enumerated ( ) Memo, Container, Map, and integer 3. Nodes required to define a table include: (Mark all that apply.) (Select all that apply.) ( ) Fields ( ) Field Groups ( ) Maps ( ) Enumerated data types

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-47

Development I in Microsoft Dynamics AX 2009

Quick Interaction: Lessons Learned


Take a moment and write down three key points you have learned from this chapter: 1.

2.

3.

2-48

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

Solutions
Test Your Knowledge
1. Task: Put the following steps in order to create a new Primary Index in a table. Step 4 : Add the primary key field(s) to the index Step 3 : Set the Allow Duplicates property on the index to No Step 6 : Set the Primary Index on the Table to the Unique Index Step 1 : Create a new index Step 2 : Set the name for the new index Step 5 : Synchronize the AOT 2. Allowable data types for an index may include: ( ) String, Integer, Real, and Container ( ) String, Enumerated, Real, and Memo () String, Integer, Real, and Enumerated ( ) Memo, Container, Map, and integer 3. Nodes required to define a table include: (Mark all that apply.) (Select all that apply.) () Fields () Field Groups ( ) Maps ( ) Enumerated data types

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

2-49

Development I in Microsoft Dynamics AX 2009

2-50

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces

CHAPTER 3: USER INTERFACES


Objectives
The objectives are: Use projects in Microsoft Dynamics AX 2009 Design and build Forms in Microsoft Dynamics AX 2009 Create customized menus and menu items Describe Microsoft Dynamics AX 2009 graphical interfaces Describe non-graphical objects in Microsoft Dynamics AX 2009 Create Queries and describe where queries can be used Use the Microsoft Dynamics AX 2009 Help documentation

Introduction
This chapter discusses how to develop the user interface without writing a single line of code. Forms are created to make it possible for the end user to enter and view data. To make navigation easier for the end user, menus and menu items will be created. Different options for obtaining help will be examined. First the Project tool that helps organize the MorphX objects that will be worked will be discussed to help build good development organization and practices.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-1

Development I in Microsoft Dynamics AX 2009

Projects
Projects organize new or customized application objects. Think of a Project as a reference folder for related objects. The project keeps related objects together in a container to help organize and identify items that are part of a customization or modification. Even though objects can be accessed through projects, they reside in their original location in the AOT. Projects are like a shortcut to application objects.

What are Projects?


One advantage of Projects is the ability to save a project's contents and state separately for each user by using Private Projects. This improvement makes it possible to have multiple users who work at the same time in Microsoft Dynamics AX 2009 without conflicts. Public Projects are used to make a Project available to all users. An additional advantage of creating a project is the ability to export the Project as one file. Another developer can then import this file. This is useful when developing in a test environment where several developers contribute to a modification. A Project file can be exported and imported from any Microsoft DynamicsAX 2009 installation to any other installation without compatibility issues. Service packs and upgrade wizards are often delivered as Projects and contain version-specific objects that are accessed for performing the upgrade.

Creating Projects
Project containers are not visible within the AOT. They are stored in their own object tree. To access projects in Microsoft Dynamics AX 2009, use the Project icon on the toolbar as shown in the Figure.

FIGURE 3.1 PROJECT ICON ON THE TOOLBAR

3-2

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Clicking the Project icon on the Microsoft Dynamics AX 2009 toolbar opens the project tree shown in this figure.

FIGURE 3.2 PROJECT TREE

The project tree is divided into Private and Shared branches: 1. Private - Only visible to the user who created them 2. Shared - Visible to all users of the specific application

Demonstration: Create a Project for the CustBirthday Table


This demonstration describes creating a shared Project for everything you have done using the CustBirthday table. 1. Right-click the Shared projects node in the Projects tree and select NEW > PROJECT. You have a choice of three types of projects: o Project - The standard project that uses standard Microsoft Dynamics AX 2009 objects. o SysTestProject - A project node that is used for storing test projects. Test projects work as a repository for collections of tests, for example, test suites. o Help Book - A help book used for creating a help manual for a project. 2. Rename the Project CustomerBirthday. 3. After renaming the project, use the same right-click menu to open the project by using the Open item shown above. o A separate window opens that contains only the CustomerBirthday project.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-3

Development I in Microsoft Dynamics AX 2009


4. Add a group by right-clicking CustomerBirthday and selecting NEW > GROUP. A group lets you organize objects of the same type such as tables, forms, and more. o Add a group for tables, remembering that other types of objects belong in the project, such as forms, extended data types, views, or other object types that you created for the Customer Birthday project. o A new group named Object1 is created in the project window. 5. Rename Object1 to BirthdayTables by right-clicking on Object1 and selecting Rename. This gives the group a more meaningful name. 6. Open the Properties sheet for the group and specify the ProjectGroupType Properties. o Give a ProjectGroupType of Tables. This restricts the group to only allow for Tables to be added or created in this group. 7. To add tables to the group, drag tables from the Data Dictionary node in the AOT into the BirthdayTables group in the new project. Drag the CustBirthday from the AOT to this group. You can also drag objects from other projects. When moving objects within projects, the object moves to the new location and is removed from the donor project. Holding down the CTRL key when dragging creates a copy of the object. 8. Save the Project by using the icon on the project toolbar. o Add new objects into a Project without a group by selecting the New option on the right-click menu on the base node of the Project.

FIGURE 3.3

Forms
Forms are the primary method of interaction between Microsoft Dynamics AX 2009 and a user. An understanding and exploration of existing forms will allow the development of new forms to retain the same look and feel as standard Dynamics AX 2009 forms.

3-4

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Elements that Compose a Form
Forms, just as other Microsoft Dynamics AX 2009 objects, are composed of multiple object categories. The basic object categories of a form are as follows: Methods Data Sources Designs

To examine these categories, open the AOT and locate the CustTable form within the Forms branch of the AOT and expand the CustTable form node as shown in the Figure.

FIGURE 3.4 CUSTTABLE FORM NODE

Form Designs
To understand Forms and their design, examine a form at run-time in the application. Some forms can be opened directly from the AOT, whereas other forms rely on information passed to it before they can open. This section works with the CustTable form, which can be opened directly from the AOT.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-5

Development I in Microsoft Dynamics AX 2009


Demonstration: Examining a Form's Design
This demonstration walks through the design of a pre-existing form. Open the CustTable form by right-clicking the CustTable form in the AOT and selecting Open. The customer Form opens and shows all its design and functionality as if it were opened from the Navigation Pane.

FIGURE 3.5 CUSTOMER FORM

Notice there is a Data Grid for the tab labeled Overview in the Customer form. This form is composed of nine tab pages, arranged on the top of the form and nine command buttons or button groups arranged at the right side. After viewing the CustTable form, open the Designs branch and compare the objects residing within it versus the Form. Navigate to the Design branch of the CustTable form in the AOT as shown below.

FIGURE 3.6 DESIGN BRANCH OF THE CUSTTABLE FORM

The groups of objects are Tab and ButtonGroup. These are referred to as controls or form controls. To view all the available controls, right-click the Design node and select New Control.

3-6

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


A sophisticated set of controls exists in the MorphX toolbox for designing forms. The controls range from simple objects such as List boxes to items like Animation controls. The advanced lessons for MorphX, which are outside the scope of this manual, go into more depth and examine the functionality and implementation of these controls. To understand the CustTable Form design and compare it to the assessment, expand the branches of the tab and button group controls on the form.

FIGURE 3.7 THE CUSTTABLE FORM DESIGN

The branches of the Design branch show all the controls that belong to the CustTable form; there are eight Tab controls and seven Buttons. The names of the controls and labels displayed on the CustTable form match what appears in the AOT. As a last examination of this design, expand the Tab Page branch labeled Overview under the Tab branch. This reveals all the objects on the first tab page of the customer form. A data grid or Grid control exists with its attached data columns. Later in this section, you design a simple form, learn how to add controls, and assign them to Data Sources.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-7

Development I in Microsoft Dynamics AX 2009


Forms and Their Data Sources
Because forms present data to users, they must provide a source for the data. These collections of data are called Data Sources and links to the Tables in the AOT.

FIGURE 3.8 DATA SOURCES FOR CUSTTABLE FORM

Open the Data Source for the CustTable form and view its Properties sheet to view which Property values are typically assigned when constructing a Data Source. The Property sheet lists useful Properties for the CustTable data source on the CustTable Form. For example, the AllowCreate and AllowDelete properties control whether new rows can be created or old rows deleted from the customer form. The Table property specifies which table the data source is based on (in this case, the CustTable). The Index Properties controls what index is used for sorting data within the Form. More than a single Data Source can be used on a Form; the linking of data between sources is performed by using the JoinSource Properties. This allows for any level of custom form design. Joining data sources on a form is examined later in this chapter.

3-8

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Forms and Their Methods
The methods involved with forms are for example methods for opening and closing the Form, and the class declaration node. Methods are the actions application objects perform. Open the methods for the CustTable Form and view the available methods.

FIGURE 3.9 METHODS FOR CUSTTABLE FORM

The init method executes when the form initializes. The close method executes just before the form closes. The ClassDeclaration method is a constructor that defines what classes the form can access. The numberSeqFormHandler method involves calling the class by the same name.

When you create a new form, understanding how to program these methods is not required, Microsoft Dynamics AX 2009 handles them automatically. The custom modification of these methods is beyond the scope of this manual as it involves knowledge of X++ and will be handled in the next class.

Creating Forms
To enter, edit, or delete data in a table from the user interface it must have an accompanying Form. When a new Form is created, MorphX automatically generates a visual layout. Microsoft Dynamics AX 2009 uses the information from its data sources to accomplish this auto-generated layout. In many cases, the system-generated layout is ready to use, but can be modified if it is required. BEST PRACTICES: Use a Project to collect all related development in a central location. This practice will allow the developer to ensure that all components are exported as a unit.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-9

Development I in Microsoft Dynamics AX 2009


Demonstration: Building a Form
This demonstration shows how to build a form. 1. Right-click the Forms node in the AOT and select New Form. 2. Rename the Form CustBirthdayForm. a. Forms retrieve information from data sources. The form you create here will display data from the CustBirthday and CustTable tables. 3. Add Data Sources to the form by dragging and dropping the tables onto the Data Sources node. a. In the AOT, right-click the Tables node and select Open New Window. b. Drag the necessary CustTable and CustBirthday tables onto the Data Sources node of the CustBirthday Form. c. This method of dragging and dropping automatically assigns the Name and Table properties of the data source. 4. Now that there are two data sources on the form, join them so the data is displayed correctly. a. Because the CustBirthday table is our primary data source in this form, join CustTable to this source. b. Set the JoinSource property to CustBirthday on the CustTable data source. Make sure that the LinkType property is set to Delayed.

FIGURE 3.10 JOINED DATA SOURCES FOR CUSTBIRTHDAYFORM

3-10

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


In the following list are the different types of links that can be used on data sources on a Form. Link Type Passive Description Linked child data sources are not updated automatically. Updates of the child data source must be programmed on the Active method of the master data source. A pause is inserted before linked child data sources are updated. This enables for faster navigation in the parent data source because the records from child data sources are not updated immediately. For example, the user could be scrolling past several orders without immediately seeing the order lines for each one. The child data source is updated immediately when a new record in the parent data source is selected. Notice that continuous updates are resourceconsuming. Selects records from the main table with matching records in the joined table - and vice versa. For example, retrieve one record for each match. Records without related records are eliminated from the result. Selects records from the main table regardless of whether they have matching records in the joined table. Selects a record from the main table for each matching record in the joined table. The difference between InnerJoin and ExistJoin: When the join type is ExistJoin, stop searching for matches after locating the first matching record. When the join type is InnerJoin, search for all matching records. Select records from the main table that do not have a match in the joined table.

Delayed

Active

InnerJoin

OuterJoin

ExistJoin

NotExistJoin

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-11

Development I in Microsoft Dynamics AX 2009


Creating Form Designs
The layout of the Form is created under the Designs node. Drag the fields or field groups from the data source to the Design node. Within this area you can organize the fields in groups, on a grid, or arrange the fields on different tab pages.

FIGURE 3.11 DESIGNS FOR CUSTBIRTHDAYFORM

Demonstration: Creating the Form Design


This demonstration shows you how to display information in a grid format. 1. Set the Caption property on the Properties sheet of the Design to Customer Birthday's so the title bar of the form is not blank. 2. Add a grid control to display the data by right-clicking on the Design node and selecting NEW CONTROL > GRID from the context menu.

3-12

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


3. To add fields to the grid, open the CustBirthday and CustTable data sources in a new window and drag the fields onto the Grid control. Add the following fields to the Grid. a. From the CustBirthday table: AccountNumber, birthday, GiftIdeas b. From the CustTable table: Name

FIGURE 3.12 ADDING A GRID AND FIELDS

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-13

Development I in Microsoft Dynamics AX 2009


A new Form with an auto-generated method is completed. Before you use this Form, review the auto design and modify as it is needed. 4. Edit the Form design by right-clicking the Design node and selecting Edit. 5. The new Form's Properties sheet and a toolbox appear.Use the toolbox to add a text box to display the current date. To add a text box, select the DateEdit component from the toolbox and select the destination on the form for the DateEdit field.

FIGURE 3.13 ADDING A TEXT BOX

6. Modify the properties of the DateEdit component on the form. Set the DateValue property to date. 7. Use the Find Label dialog to find the label Today and set it as the Label property for the new DateEdit control.

3-14

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


The final form appears below.

FIGURE 3.14 COMPLETED FORM

Forms Creation
Create a new Form accessing the CustTable table called CustTest. Create a new Form in Microsoft Dynamics AX 2009 that has the following requirements Properties: Uses the customer table CustTable as the Data Source. Use a Tab in your design. Add a Tab Page to your Tab. Use a Grid control as the Tab Page. The following columns should be on your Grid - AccountNumber and Name. Label the Tab Page as Customer Info. Set the Caption Properties of your design to @SYS19920 using the label finder. There is a Properties named TitleDatasource which must be set for the Caption to operate correctly. Set it to your Data Source. Name your new form to CustTest.

The final form when it is compiled and saved should resemble this form:

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-15

Development I in Microsoft Dynamics AX 2009

Lab 3.1 - Forms Creation


Create a new Form accessing the CustTable table called CustTest.

Challenge Yourself!
Create a new Form in Microsoft Dynamics AX 2009 that has the following requirements Properties: Uses the customer table CustTable as the Data Source. Use a Tab in your design. Add a Tab Page to your Tab. Use a Grid control as the Tab Page. The following columns should be on your Grid - AccountNumber and Name. Label the Tab Page as Customer Info. Set the Caption Properties of your design to @SYS19920 using the label finder. There is a Properties named TitleDatasource which must be set for the Caption to operate correctly. Set it to your Data Source. Name your new form to CustTest.

3-16

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


The final form when it is compiled and saved should resemble this form:

FIGURE 3.15

Step by Step
Solution
1. Right-click the Forms node in the AOT and select New Form. 2. Right-click the NewForm1 and Rename it CustTest. 3. Expand the CustTest form node and right-click Data Sources and select New Data Source. 4. Right-click DataSource1 and select Properties to open the Properties sheet. 5. Set the Table Properties to CustTable. Close the Properties sheet. 6. Expand the Designs node, right-click the Design branch, and select New Control and Tab. 7. Right-click the Tab branch and select New Control and TabPage. 8. Expand the Tab branch, right-click TabPage:TabPage, and select New Control and Grid. 9. Right-click the Grid: Grid branch and select New Control and StringEdit. 10. Repeat step 9 to create a second field. 11. Right-click the StringEdit:StringEdit branch and select Properties to open the Properties sheet. Set the DataSource property to DataSouce1 and the DataField property to AccountNum. 12. Right-click the StringEdit1:StringEdit1 branch and select Properties to open the Properties sheet. Set the DataSource property to DataSuouce1 and the DataField property to Name.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-17

Development I in Microsoft Dynamics AX 2009


13. Right-click the TabPage: TabPage branch and select Properties to open the Properties sheet. Set the Caption property to Customer Info. 14. Right-click the Design branch under the Designs node and select Properties to open the Properties sheet. 15. Search for the symbol @sys19920 in the Caption property. 16. When the symbol is located, click the Paste Label button to paste the label ID to the Caption property. 17. Right-click the CustTest form and select Properties to display the properties sheet. Set the Name Properties to CustTest. 18. Open the Form; it should resemble the one above.

3-18

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces

Menus Items in MorphX


Use menu items to enable activation of application objects from the user interface. A menu item contains five key properties: Name - The name of this menu item Label - The label appearing on the menu item ObjectType- The type of object this item points to Object - The object name that this item points to RunOn - The location (Client or Server) where the called object will run Security Key - A key defined in the data dictionary that defines the security access for the menu item

There are three types of menu items that can be created: Display Output Action

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-19

Development I in Microsoft Dynamics AX 2009


Display Menu Items
Display menu items open objects that appear on the screen, typically forms. For example, clicking the Customers menu item in the Accounts Receivable module opens the CustTable form. This Display Menu item points to the Form object CustTable.

FIGURE 3.16 MENU ITEMS

3-20

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


The Properties sheet of the Display Menu Item associated with opening the Customer form.

FIGURE 3.17 MENU ITEMS

There are two important Properties to notice. Class property = Form Object property = CustTable

The Class property sets the class of item that appears, whereas the Object property is the name of the object itself. When you open the menu item, a form named CustTable opens.

Demonstration: Creating a Display Menu Item


This demonstration creates a menu item named ZipMenuItem. This new menu item displays the ZipCode form when it is put in a menu. 1. Create a new menu item to start a form by right-clicking on the Display menu item node in the AOT. 2. Rename the menu item to ZipMenuItem.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-21

Development I in Microsoft Dynamics AX 2009


3. In the properties sheet, set the Object property to AddressZipCodes. Because this is a display menu item, the Class property is automatically set to Form. 4. Assign the label ZIP/postal Code reference to this menu item by searching for this label using the Find Label dialog box. 5. Save the menu item.

FIGURE 3.18

The new menu item is now available to be added to a new or existing menu.

Output Menu Items


Use output menu items for starting objects that generate output, typically reports. These objects often open a standard report directly or can be classes that generate dialog forms used for printing reports. These dialog forms have a similar structure. The basic buttons always visible on these output forms are as follows: Select Default Options

3-22

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


The buttons prepare report output as follows: Select - Displays an Inquiry window for report preparation Default - Regenerates the default parameter setup for printing the report Options - Enables selection of printing options

The figure illustrates the form that enables the outputting of the Customer Turnover report (CustRevenue).

FIGURE 3.19 CUSTOMER TURNOVER FROM OUTPUT MENU ITEM

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-23

Development I in Microsoft Dynamics AX 2009


This Figure illustrates the Properties sheet for the CustRevenue menu item.

FIGURE 3.20 CUSTREVENUE PROPERTIES SHEET

There are two important properties to notice. Class property = Class Object property = CustReport_Revenue

The CustRevenue Output Menu Item directly calls the class named CustReport_Revenue.

Action Menu Items


Action menu items link to objects that are used for producing actions. An action in Microsoft Dynamics AX 2009 is an event such as creating a customer collection letter, or a BOM approval. The action menu item is a link to execute a certain class or query, or to open a form related to a particular event.

3-24

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


The Figure illustrates the output resulting from creating a collection letter.

FIGURE 3.21 COLLECTION LETTER FROM ACTION MENU ITEM

The property sheet of an action menu item is structurally identical to an Output menu item.

Navigation Pane and Area Pages


The Navigation Pane contains all of the menus that have been added to the menu MainMenu. The Navigation Pane also includes the Places and Forms sections.

Menus Access By Using MorphX


This section discusses creating new menus in Microsoft Dynamics AX 2009 and adding menu references. Menus are forms used for navigating within Microsoft Dynamics AX 2009 application. Menus always contain menu items, sub-menus, or references to other menus. Menus are essentially containers for menu items. The standard components consisting of a menu are in the following list: Menu Items - These point to a specific display, output, or action object Sub Menus - Folders that act as sub-menus within menus Separators - The graphical separators between menu items Menu References - References (shortcuts) to other menus

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-25

Development I in Microsoft Dynamics AX 2009


To understand how Microsoft Dynamics AX 2009 uses a menu within the Content Pane form, review the Figure:

FIGURE 3.22 ACCOUNTS RECEIVABLE CONTENT PANE

The Cust menu in the AOT represents the accounts receivable menu. Recall this menu is a part of a larger menu, the MainMenu. To understand how these menu objects interact, expand the Menus node in the AOT as shown in the following figure.

FIGURE 3.23 EXPANDED MENUS NODE IN THE AOT

3-26

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Search the Menus node for the folder named MainMenu. Expand the MainMenu objects node as shown in the following figure to view the design of Microsoft Dynamics AX 2009's Navigation Pane.

FIGURE 3.24 EXPANDED MAINMENU NODE

The small arrow on the folder indicates that these are menu references for the Microsoft Dynamics AX 2009 Navigation Pane. If you view the properties for the Accounts receivable menu reference in the MainMenu, note the object name of the menu is Cust. The menu reference points to the Cust menu. Locate the Cust menu and open its node. Notice you are viewing the objects that are seen from the Accounts receivable menu of Microsoft DynamicsAX 2009. The Cust menu consists of the following submenus: Journals Inquiries Reports Periodic Setup

The visible menu items shown within the parent menu are as follows: Sales order Free Text Invoice Customers

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-27

Development I in Microsoft Dynamics AX 2009


When you create menus use menu items, submenus, and menu references. Insert separators for grouping similar items together and for cosmetic purposes.

Demonstration: Adding a Menu Item to a Menu


A previous demonstration walked through creating a menu item named ZipMenuItem that was a link to the ZipCodes form. This demonstration discusses adding the ZipMenuItem to the Cust menu. 1. Locate the Cust menu in the Menus node in the AOT by rightclicking on the Cust node and selecting New > Menu item. o To improve the look of the menu, drag the new menu item to the area where the other menu items reside.

FIGURE 3.25 ADDING A NEW MENUITEM

2. Assign the MenuItemName property ZipMenuItem. The properties associated with ZipMenuItem such as Label and Object Properties are inherited. 3. To test the menu item highlight it and open it. Verify it contains the ZipCodes form. A quicker alternative for adding a menu item to an existing menu is using the drag and drop functionality in MorphX. Drag the menu item onto the specified menu.

3-28

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Demonstration: Create a Menu and Add a Menu Reference
This demonstration discusses creating a menu and adding a menu reference. 1. Create a new menu to contain the ZipMenuItem by right-clicking on Menus in the AOT and selecting New Menu. 2. Rename the new menu ZipCode and give it a label of Zip Codes. 3. Drag the ZipMenuItem menu item onto this menu. o At this point you could set certain security rights on this menu in the properties of the menu. 4. Add this menu as a menu reference to the Navigation Pane by locating the MainMenu in the Menus node, right-clicking, and selecting New > Menu Reference. 5. Locate the ZipCode menu from the new window and drag it as shown to the MainMenu. Rearrange menu references as you want. 6. To test the new menu, close and open the Navigation Pane to determine whether the Zip Code menu is available. The Navigation Pane now has another tab labeled Zip Codes. Within this tab you can access the Zip code reference menu item.

FIGURE 3.26 DRAGING A NEW MENU REFERENCE

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-29

Development I in Microsoft Dynamics AX 2009


Navigation Pane
The Navigation Pane is on the left-hand side of the AX 2009 window. It contains all of the menus that have been added to the menu MainMenu within AX 2009s AOT. New in Dynamics AX 2009 the Navigation Pane contains the Places and Forms sections.

FIGURE 3.27 NAVIGATION PANE

Places
Places is a new functionality in Dynamics AX 2009 located within the Navigation Pane. The Places section contains an Area Page link and links to Menu Items that have been appropriately designed. Clicking on a Menu Item other than the Area Page, in the Places section of the Navigation Pane will launch that Menu Item as either a List Page or as a Single Document Interface (SDI) form.

3-30

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


A Menu Item is automatically added into the Places section if that Menu Item has the property IsDisplayedInContentArea = Yes. In the figure the Chart of Account Details menu item is displayed in the Places section of the Navigation Pane because it has IsDisplayedInContentArea = Yes.

FIGURE 3.28 A MENU ITEM IN PLACES

NOTE: Single Document Interface (SDI) forms are one of the biggest changes to the user interface in Dynamics AX 2009. In previous versions of Dynamics AX 2009 all forms were Multi-Document Interface (MDI) forms. The advantage of SDI forms is that they located outside of the Content Frame as a separate Window.

Forms
Forms is a new section within the Navigation Pane that contains links to all other Menu Items that are not set to be displayed in Places.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-31

Development I in Microsoft Dynamics AX 2009


Area Pages
Clicking on the Area Page link in the Places section of the Navigation Pane will open the Area Page for that module in the Content Frame (the area to the right of the Navigation Pane).

FIGURE 3.29 NAVIGATION PANE AND GENERAL LEDGER AREA PAGE

The Area Page can be used as an alternate means of navigating through the system as it displays all of the forms that are listed within the Navigation Pane. The Area Page cannot be developed. It is generated by Dynamics AX 2009 using the structure of the menu that is displayed. An Area Page and its link will be created automatically whenever a new menu is created in the AOT. NOTE: List Pages are a new type of form that will display read-only lists within the Content Frame. List Pages are beyond the scope of this course, and are addressed in a more advanced course.

Menu Items Creation


Develop a new menu item that will open the CustTest form you have developed in the previous exercise.

3-32

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Requirements of this exercise are the completion of a new menu item with the following Properties: Menu Item opens the CustTest form that you created in the previous exercise Select the appropriate type of menu item Select the correct object class and object Name and label the new menu item CustTest Put the new menu item on the Accounts Receivable menu, located below the Customers form

Your completed menu item, when it is opened, contains the CustTest form.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-33

Development I in Microsoft Dynamics AX 2009

Lab 3.2 - Menu Items Creation


Develop a new menu item that will open the CustTest form you have developed in the previous exercise.

Challenge Yourself!
Requirements of this exercise are the completion of a new menu item with the following Properties: Menu Item opens the CustTest form that you created in the previous exercise Select the appropriate type of menu item Select the correct object class and object Name and label the new menu item CustTest Put the new menu item on the Accounts Receivable menu, located below the Customers form

Your completed menu item, when it is opened, contains the CustTest form.

Step by Step
Solution
1. Expand the Menu Items node in the AOT. Right-click the Display node, and select New Menu Item. 2. Open the Property sheep and set the Class property to Form. 3. Set the Object property to CustTest. 4. Set the Name and Label Properties to CustTest. 5. Right-click the CustTest branch under the Display node and select Save. 6. Right-click the CustTest branch under the Display node and select Open. 7. Your CustTest Form should open. 8. In the AOT, expand the Menus node and locate the Cust menu and expand. Right-click the Cust menu and select New then Menu item. 9. Open the properties for the new menu item. The MenuItemType should be Display and the MenuItemName should be CustTest. 10. Position the new CustTest menu item below the Customers menu item. 11. When you now open the Navigation Pane your CustTest menu should be available in Accounts Receivable.

3-34

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces

Microsoft Dynamics AX 2009 Non-graphical Objects


This section discusses additional objects that are used in Microsoft Dynamics AX 2009 applications, such as classes that are dedicated to data processing and event management. This section also covers macros and jobs, which are used for: Project containment Scripting and testing application code Scripting and testing custom developed X++ code segments

Classes
Classes have the following characteristics: Classes allow reuse common functionality or business logic. Classes are a design or blueprint for a programming object. After a set of Classes is defined, they can be used programmatically from all the other application objects. Classes can be run directly from the AOT if a Main method is defined, although this is not a common practice. Classes are used for solving tasks for other application objects, such as forms and reports. Classes in Microsoft Dynamics AX 2009 share the same attributes a class in C# has, such as inheritance, polymorphism, and encapsulation.

You may be tempted to start with coding as the first step. This approach is not ideal in a Microsoft Dynamics AX 2009 application because code runs in the context of an application object and an associated event. A class contains all the properties, methods, and variables needed by an object. A class can be created by right-clicking the Classes node of the AOT, and selecting New class or by using the Class Wizard located in the Tools menu.

Class Methods
When developing a class it contains three nodes by default: The Class Declaration node specifies the name of the class and the necessary variables. It can also specify inheritance.

NOTE: Class Declaration is not a method. It is a class-level scope area that defines global variables for all methods within the class.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-35

Development I in Microsoft Dynamics AX 2009


The New method is used every time that a new object is instantiated. You can also assign values to object variables using this method. The method is hidden until it is overridden. The Finalize method terminates the object. This method is rarely used, because the object no longer exists when the object handle is set to null. This method is not visible until it is overridden.

Classes are covered in detail in the course Development II: Introduction to X++, and are beyond the scope of this tutorial on MorphX.

Macros
Macros act as a container for defining variables used for frequent tasks. The purpose of macros is to make statements easy to reuse. A macro cannot be executed independently of a class. They serve in the same manner a header file might serve for data structure definition, because they provide definition values of Properties associated to an object. An example of a Macro is a File macro. The File macro provides: Definitions of file extensions Input/Output definitions XML file definition Delimiter information

A sample of a macro named File is shown in the following figure that describes file extensions. File extensions are definitions for objects in Microsoft Dynamics AX 2009 that must use files. This macro enables file extensions to be defined in a single central location, where all file aware classes can have use of it.

FIGURE 3.30 FILE EXTENSION MACRO

The macros node in the AOT contains macros used by the standard application. Here are some key points of macros. They can be declared wherever you can write X++ statements and contain code that can be useful in several places. An advantage of defining a macro is that the maintenance is done in only one place. A macro cannot run independently, but can be used anywhere you can write code in the system, such as in jobs, classes, and forms.

3-36

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Macro Types
There are three ways that macros in Microsoft Dynamics AX 2009 are packaged. Macro libraries Stand-alone macros Local macros

All types of packaging have identical syntax and functionality. The differences between the packaging are: A standalone macro is created by using the macro node of the AOT. A local macro is declared within a method or stand-alone macro. A macro library is a standalone macro that contains a collection of local macros.

Generally, define a class instead of writing macros for work involving statement logic. Macros are covered more in detail in advanced classes in X++ and MorphX development.

Jobs
The jobs node on the application object tree contains small X ++ programs that are executed as batch jobs. They are useful when developing and testing new functionality for Microsoft Dynamics AX 2009. The jobs node on the AOT is empty after installing and configuring the Microsoft Dynamics application. These batch jobs can be scheduled to run at specific times.

FIGURE 3.31 JOBS IN THE AOT

Create a new job by selecting New Job when right-clicking on the Jobs node in the AOT. The Job skeleton named Job1 is created. Use the Edit method from the MorphX right-click menu to create new X++ code you can test or modify existing code within a job.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-37

Development I in Microsoft Dynamics AX 2009


The following Figure illustrates that Job1 is a shell for a static method when you open it using the Jobs Editor.

FIGURE 3.32 JOB1 SHELL

Jobs have the following characteristics: When testing new code, jobs save development time by eliminating creating a new class and defining a new method. A job is a static method that returns nothing and can be attached to a form for testing. They are primarily used in the production environment only to run batch work in the background.

Microsoft Dynamics AX 2009 includes several batch processes already a part of the system. Jobs are discussed in Development II.

Queries
Queries ask questions about data stored in a database. The information selected by a query can be used as the basis for a form, auto report, or another query. The query extracts data from a database and presents it in a form for viewing. Although the query does not provide a graphical viewing interface, Microsoft Dynamics AX 2009 provides a specialized form named a query dialog form.

3-38

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


What are Queries and How Do They Work?
Using a query, retrieve data from tables within the database and/or views that are logical tables. When a query is designed in the AOT, the user must determine the information the query returns.

FIGURE 3.33 ASSETBOOK DATA SOURCE

The Asset Proposal query uses the AssetBook and AssetTable tables as its data source. Basic components of a query are composed of: Methods Data Sources

Data sources have their own field objects and methods such as sorting. A query resembles a view except it is not static because it can be modified at run time. Often, queries are used behind the scenes and are never viewed by the user. This is the case when X++ based queries set the position of a data source on a form. Query objects that are created in the AOT can be viewed by using the query dialog form. The query dialog form in this section is a system form named SysQueryForm. The SysQueryForm is the standard form used by Microsoft Dynamics AX 2009 for presenting graphical dialog boxes that enable the design and modification of queries by the end user. To show how the query is linked to the SysQueryForm, view the properties sheet of the AssetProposal query. Open the Asset Proposal query so for analysis in the query dialog form.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-39

Development I in Microsoft Dynamics AX 2009


The Asset Proposal query returns the query dialog form populated with the fields in the Ranges branch of its data sources.

FIGURE 3.34 ASSET PROPOSAL QUERY RESULTS

The query dialog shown in the proceeding figure is the result of the query design.

3-40

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


To understand the query dialog box, examine the data sources of the AssetProposal query. Expand the Ranges node and the Data Sources node as shown in the following figure.

FIGURE 3.35 EXPANDED RANGES AND DATA SOURCES NODES

The Data Sources branch refers to tables that are used by the query; Ranges refers to the fields available to the query dialog form. The data sources and Relations objects together form all the possible fields available to the query. Fields in the Ranges branches appear in the query Dialog design form when it opens. The design of a query at runtime is a temporary change that is not stored after the design change occurs. The user can add different tables, table joins, fields, field criteria, and have their custom design run one time.

Demonstration: Create a Query


This demonstration discusses creating a query based on the CustBirthdayView view. The query is designed so that it only selects customer accounts where the GiftIdea field is equal to Theater Tickets by default. You can later base an auto report on this query and run it any time to find which customers want theater tickets. 1. Right-click the Queries node in the AOT. Rename the query CustomerTickets and title it Ticket Needs. 2. To add the data source for the query, drag the CustomerBirthdayView onto the Data Sources node of the query.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-41

Development I in Microsoft Dynamics AX 2009


3. Add ranges to the query. Expand the Fields and Ranges branches. Add the AccountNumber, birthday, and GiftIdeas fields to the Ranges node. o Drag fields into the Ranges branch from the Fields branch. After dragging the fields to the Ranges node and closing the Fields node, the query appears as shown in the following figure.

FIGURE 3.36 QUERY IN THE AOT

4. Open the query to view its results. Set the criteria field for GiftIdea. 5. Set the Criteria property to the value of Theater Tickets using the drop-down menu on the query dialog form. The Customer Tickets query is finished and can be used in a report that shows customers who wants theater tickets as a gift.

Help Documentation
Microsoft Dynamics AX 2009 2009 includes a Help system that is based on Compiled HTML Help files (chm files). The Help system can be accessed from Microsoft Dynamics AX 2009 to provide assistance with the application; however, it is also available from outside the application. The help system is spilt into several files to reflect the job roles associated with Microsoft Dynamics AX 2009. Each Help file is editable by using a Chm file tool such as HTML Help Workshop. The same tool can be used for creating new Help files for Partner Solutions. Chm files do not have to be indexed or initialized during installation. This can save time. The Help files are continuously updated and made available for download.

3-42

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


System Documentation
The Microsoft Dynamics AX 2009 system documentation is under AOT's System documentation node and contains links to manuals for the development environment. To access system documentation: 1. Open the AOT from the toolbar and expand the System documentation node. The documentation is categorized by sub nodes. 2. Expand the sub nodes to view the documentation that is contained in each category. Under the Classes sub-node there are hundreds of classes. Documentation in this node describes properties and methods. The type of information in the system documentation node is intended for developers. Under the Functions sub-node there are hundreds of useful functions you will use when programming in X++.

Application Developer Documentation


The Microsoft Dynamics application developer documentation is located under the Application developer documentation node and contains links to reference documentation for application tables and classes. To access the application developer documentation: 1. Open the AOT from the toolbar and expand the Application developer documentation node. The documentation is categorized by sub nodes. 2. Expand the sub nodes to view the documentation that is contained in each category. Under these nodes you find documentation about the tables and classes used by Microsoft Dynamics AX 2009. The documentation is intended for developers. The information in this node is technical, not functional information. To find functional information for end users, look in the application documentation.

Application Documentation
The Microsoft Dynamics AX 2009 application documentation is located under the Application documentation node and contains reference documentation for the Microsoft Dynamics AX 2009 application. Documentation is also available on forms in the application.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-43

Development I in Microsoft Dynamics AX 2009


To access the application documentation: 1. Open the AOT from the toolbar and expand the Application documentation node. The documentation is categorized by sub nodes. 2. Expand the sub nodes to view the documentation that is contained in each category. This documentation is available through the general Microsoft Dynamics AX 2009 help menu in the application toolbar.

FIGURE 3.37 ACCESSING HELP

NOTE: You can check if there is an updated version of the Help file. Just click Check for Updates on the Help menu. You can also check this site for more information: http://www.microsoft.com/dynamics/ax/using/default.mspx

Summary
This course discussed how to develop the user interface without writing a single line of code. This course also made it possible for end users to enter and view information using Forms that were created. To make navigation easier for the end user, menus and menu items were created. Different options for obtaining help were examined. Tools such as the Project Tool were reviewed to help organize the MorphX objects that were worked upon. The next course examines the Report functionality in Microsoft Dynamics AX 2009.

3-44

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces

Test Your Knowledge


Test your knowledge with the following questions. 1. The three (3) elements for a Form include: ( ) Methods, Data Sources, and Views ( ) Designs, Methods, and Data Sources ( ) Display Menu Items, Data Sources, and Designs ( ) Jobs, Menu Items, and Macros 2. The Area Pages can be customized by: ( ) Making changes to the Areas node in the AOT ( ) By making changes to the Menus that the Areas page will automatically be generated from ( ) By setting the IsDisplayedInContentArea property of the Navigation Pane ( ) The Area Pages cannot be changed 3. Available Project types available are: Mark all that apply. (Select all that apply.) ( ) Project ( ) Help Project ( ) SysTestProject ( ) Test Project 4. Available Menu Items are: Mark all that apply. (Select all that apply.) ( ) Display Menu Items ( ) Output Menu Items ( ) Project Menu Items ( ) Report Menu Items

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-45

Development I in Microsoft Dynamics AX 2009

Quick Interaction: Lessons Learned


Take a moment and write down three key points you have learned from this chapter: 1.

2.

3.

3-46

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces

Solutions
Test Your Knowledge
1. The three (3) elements for a Form include: ( ) Methods, Data Sources, and Views () Designs, Methods, and Data Sources ( ) Display Menu Items, Data Sources, and Designs ( ) Jobs, Menu Items, and Macros 2. The Area Pages can be customized by: ( ) Making changes to the Areas node in the AOT () By making changes to the Menus that the Areas page will automatically be generated from ( ) By setting the IsDisplayedInContentArea property of the Navigation Pane ( ) The Area Pages cannot be changed 3. Available Project types available are: Mark all that apply. (Select all that apply.) () Project ( ) Help Project () SysTestProject ( ) Test Project 4. Available Menu Items are: Mark all that apply. (Select all that apply.) () Display Menu Items () Output Menu Items ( ) Project Menu Items ( ) Report Menu Items

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-47

Development I in Microsoft Dynamics AX 2009

3-48

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 4: Report Adjustments

CHAPTER 4: REPORT ADJUSTMENTS


Objectives
The objectives are: Design reports using the visual report designer in Microsoft Dynamics AX 2009 Design reports effectively using standard report elements Design reports using different methods Create report and section templates Describe how best practices are used when creating reports

Introduction
A report presents information from a database as a printed document. Use reports to print invoices or complex summaries. All reports in Microsoft Dynamics AX 2009 are located in the AOT, where report elements can be accessed and adjusted. Several tools are designed to help perform adjustment tasks. MorphX helps to design reports that present information by using a graphical tool named the Visual Report Designer. This tool can combine many different design elements into one report, such as: Labels Data from the database Lines Graphics

The Visual Report Designer is located under the reports node in the AOT. The Visual Report Designer will be reviewed first, followed by the two types of report designs Auto Design and Generated Design. Lastly, reusable templates will be examined for both reports and sections. See the Appendix topic, "Case Study".

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

4-1

Development I in Microsoft Dynamics AX 2009

The Visual Report Designer


The Visual Report Designer is located under the reports node in the AOT.

Demonstration: Working with the Visual Report Designer


This demonstration will show all the components of the Visual Report Designer. 1. Locate the existing report named CustRevenue in the AOT and expand it. The three major components of the report are as follows: Methods, Data Sources, and Designs. 2. Expand the Designs node and the ReportDesign subnode; now an AutoDesignSpecs node exists. Double-click the AutoDesignSpecs icon to start the Visual Report Designer. o In the Visual Report Designer, the report is supplied with a horizontal and vertical ruler to help position report elements exactly as possible. Use this tool to change the units of measure. 3. Right-click the ruler to select the measuring unit of Inches. o The vertical margin is divided into sections of the report such as Header, Body, Prolog, and Page. The CustRevenue report only contains a body section. 4. Each element on the report has individual properties that can be viewed in the properties sheet like all other objects.

FIGURE 4.1 REPORT VISUAL DISIGNER

Working with Report Element Properties


Many elements on a report can be edited using the report's property sheet. Many properties have default or auto values and do not need to be changed unless they do not match the needed preferences. A default value is a system-generated value that does not have to be specified before a report is completed.

4-2

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 4: Report Adjustments


Demonstration: Modifying Report Properties
The demonstration shows some of the common properties that are edited in the Visual Report Designer. 1. Open the CustRevenue report in the Visual Report Designer, click the Body section, and then click the Properties button to display the Properties sheet. o The properties for columns are set to the default value of Auto. o This indicates that the report designer arranges the fields on the page to allow for the most number of columns per page. 2. Activate the Columns property and then click the Toggle button.

FIGURE 4.2 COLUMN PROPERTY FOR THE BODY

Use this to override the default value and specify the number of columns viewed on the report. By clicking the toggle button again, it returns to the default value.

3. Add a field to the body of the report by right-clicking in the body and selecting New. There are several options available, but for now focus on the option Field from CustTable. 4. Select this option to display the list of fields from the data source.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

4-3

Development I in Microsoft Dynamics AX 2009


5. To add a new field, drag the field from the list and drop it on the report. o To change the position, drag the element and drop it in another location. o Notice the Left and Top properties on the Properties sheet. o As the position changes on the report, the properties change to reflect the current position. The Left property indicates the distance from the left margin whereas the Top property indicates the distance from the top margin.Label Properties on a Report Element Labels on a report describe the fields and do not have a value. Labels have the following characteristics: Several properties governing the look, position, and size of the label can be specified. The ChangeLabelCase property changes the case of the label text on the report. The LabelTabLeader property inserts a series of dots between the label and the field value, similar to a table of contents in a book. Every element displayed in the Visual Report Designer is also located in the Designs node of the report in the AOT.

Reporting Best Practices


When designing a report, many details about the environment in which the report is executed are not known. Common factors to consider: The size of the paper in the printer The length or the contents of the labels used in the user's language The length of the fields and extended data types at the user's installation The number of dimensions at the user's installation How dates and numbers are formatted The size of amounts in the user's system The sort order of the data sent to the report If the user wants to print only the totals or subtotals What font and size the user has set up as report defaults

NOTE: Learning best practices means to become aware of all the things to do, and then being able to distinguish which of these can be realistically accomplished.

4-4

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 4: Report Adjustments

Report Design
A report in the AOT resembles a form. They both contain Methods, Data sources, and Designs. An important difference is that the data source element in reports consists of a query not a table. Microsoft Dynamics AX 2009 enables reports to have designs generated automatically so that the developer does not have to specify a report layout. The design of a report is controlled from the Designs node. Within the Designs node there are two types of design specifications: AutoDesignSpecs GeneratedDesign

Using Auto Design Specifications


When using AutoDesignSpecs, the report layout is generated when the report is run. Its content and layout is based on the query used for the report.

Demonstration: Using the Auto Design Specs


This demonstration creates a new report using the Auto Design Specifications. The design structure of the report is not generated until runtime, where it is generated based on the information entered in the query and the layout of the Report Template. One of the first things to do is to add data sources to the query of the report. 1. Create a report. Name the report MyReport by right-clicking the Report node in the AOT and selecting New > Report. 2. Expand this report in the AOT until it is possible to view the Data Sources node of the Query. 3. Drag the CustTable table onto this node to add this as a data source. Then drag the CustTrans table onto the data sources node of the CustTable_1 data source. 4. Create a relation between the two data sources. Right-click the Relations node of the CustTrans data source and select New Relation. Confirm that this relation is on the AccountNum fields of both tables. Also confirm that the JoinMode property of the CustTrans_1 data source is set to InnerJoin.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

4-5

Development I in Microsoft Dynamics AX 2009


At this point, the report resembles the following figure.

FIGURE 4.3 THE FINAL LAYOUT OF THE REPORT

NOTE: Instead of using a table in the report datasource, a Query may also be used by dragging and dropping the Query from the AOT to the Report Datasource. Now a Design for MyReport must be created. 1. Right-click the Designs node and select New Report Design. 2. Expand the ReportDesign1 node to reveal the AutoDesignSpecs node. Right-click this node and select Generate Specs From Query. The nodes created under this one correspond to the tables within the query. 3. Add fields to these groups in the design. On the CustTable_Body node, right-click and select the new control Field from CustTable. Drag the AccountNum, Name, and Address fields onto this node. 4. Repeat this process for the CustTrans_Body node by using the new control Field from CustTrans to add TransDate, Voucher and AmountMST. 5. Save the report.

4-6

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 4: Report Adjustments


6. View this report by right-clicking it in the AOT and selecting Open. 7. Specifying criteria to view the report is not needed. Click OK on the inquiry screen. Make sure that the report is printing to the screen and then click OK again. The report looks similar to the following figure.

FIGURE 4.4 DEMONSTRATION REPORT OUTPUT

Generated Design Specs


Use the GeneratedDesign option to design custom reports. In a GeneratedDesign, the layout is dictated by the design structure created in the Visual Report Designer and not by a query or report template. A report that is created by using the GeneratedDesignSpecs option has several differences from one created by using AutoDesignSpecs. One main difference is that a custom design is not affected by the structure of the underlying query. The design is defined by the developer and not generated automatically. Another difference is that changes made to the standard report template, if it is used do not affect the design of a report using the GeneratedDesignSpec option.

This is the recommended method to use if a specific format and look is required.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

4-7

Development I in Microsoft Dynamics AX 2009


Demonstration: Create a Custom Report Design
This demonstration creates a report that contains a list of items belonging to a particular asset group. 1. Create a new report by right-clicking the Reports node and selecting New Report. Name the new report AssetGroupListing. 2. Right-click Designs and select New Report Design from the menu. 3. Right-click the ReportDesign1 branch and select the Generate Design command. a. This generates an empty container named GeneratedDesign that can be used to build a custom report.

Demonstration: Create a Custom Report Layout


Add a data source to this report. 1. Expand the Reports Data Source node and the Query branch of the report to expose the Data sources of the query. This Data Sources branch is used to create the queries that provide the data for the report. 2. Drag the AssetTable table onto the Data Sources node of this query. 3. Drag the AssetGroup table onto the Data Sources node of the AssetTable data source. The report layout looks as follows:

FIGURE 4.5

4-8

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 4: Report Adjustments


For data to appear correctly on the report, the data sources in the query must be joined correctly. A relationship must be created between data sources. 1. Locate the Relations branch on the AssetGroup data source node of the report. 2. Right-click the Relations node and select New Relation. a. By default, Microsoft Dynamics AX 2009 tries to create a logical relationship between data sources. Because in this case, the default selection is incorrect; modify the properties of this relation. 3. Open the properties sheet for this relation. a. The Table property is assigned to AssetTable. This is the parent table for the report, and the RelatedTable property is assigned to the AssetGroup table. b. An appropriate relationship must be made between the tables. 4. Select AssetGroup for the Field property and GroupID for the RelatedField property. In the underlying data, both GroupID and AssetGroup contain the same information. This makes a logical relationship.

Sections within a Report


Creating a custom generated report requires adding and organizing sections. This is true for both AutoDesign and GeneratedDesign reports. The main difference is that the AutoDesign report always has a Body section created based on the query associated with the report. When designing a report in Microsoft Dynamics AX 2009 with data organized into a logical presentation, use sections. Sections are organizational containers that hold different information to be included in a report. The different section types that can be used are as follows: Prolog - The Prolog appears at the start of a report. It is printed before the page header on the first page of the report. Use it to display elements such as a logo, a report title, and current date. PageHeader - The PageHeader appears at the top of every page in the report. Use it to display for example page number, date, and time. Header - The Header appears at the start of a new group of records. Use it to display information such as group name. Section Group - The Section Group appears in the middle of the report. A section group can contain a Header, Body, or a Footer section. The structure of the data sources is reflected in the structure of the section groups.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

4-9

Development I in Microsoft Dynamics AX 2009


Footer - The Footer appears at the end of a group of records. Use it to display information such as sub totals. PageFooter - The PageFooter section appears at the bottom of every page in a report. Use it to display information such as page numbers, if the page numbers are not already inserted in the PageHeader. Epilog - The Epilog appears at the end of the report. Use it to display information such as disclaimers and general statements. The Epilog is printed just after the page footer on the last page in the report. ProgrammableSection - The ProgrammableSection contains any kind of customized information.

FIGURE 4.6 REPORT SECTIONS

Demonstration: Building a Custom Generated Report


To start designing a custom generated report, highlight the GeneratedDesign icon of the AssetGroupListing report and add relevant sections: 1. Add a PageHeader section. Right-click the Generated Design node and select New > Page Header. 2. Add a Section Group to the report. 3. Within the Section Group, add a Header, Body, and a Footer. 4. Add a Footer section to the Generated Design. Now add relevant controls and fields to the sections of the report. 5. The demonstration shows how to modify the PageHeader by adding a heading that appears in every page that has a line under it and a page number. a. Set the LineBelow property on the PageHeader section to Solid. b. Right-click the PageHeader node and select New Control > Text. Then, modify a property on this control. Set the Text property to Asset Table.

4-10

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 4: Report Adjustments


c. Create the page number field by right-clicking the PageHeader node and selecting New Control > Integer. Set the Left property to Right Edge. Set the DataMethod property to page. This data method returns the current page number on each page of the report. d. Notice when the data method is set, the icon for the control changes from red to green indicating the control compiles successfully. HINT: Another useful DataMethod on reports is the pages Total data method. This returns the total number of pages in the report. This is useful to display the page number as Page of Total Pages. For example, 3 of 10.

Demonstration: Building a Custom Generated Report


1. Add fields to the Body of the Section Group from the AssetTable table and one from the AssetGroup table. Add a new control type Field from AssetTable. a. Fields from AssetTable: AssetID, Name, InsuredValue 2. The SumAll property on the InsuredValue field must be set to Yes.Add the AssetType field from the AssetGroup table to the Body between Name and Insured Value. 3. Add a sum control to the Footer of the Section Group. The DataFieldName property on this control must match the Name property for the InsuredValue field in the body of the section group. Also, add a solid line above this field. 4. Add a sum control to the Footer of the report. This should also be a sum for the InsuredValue field by setting the Data Field Name property. Change the LineAbove property to Double for this field.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

4-11

Development I in Microsoft Dynamics AX 2009


5. Now that the report design is complete, view the report by rightclicking on the report in the AOT and selecting Open. The criteria for this report does not need to be specified. Verify the report is printing to the Screen and click OK.

FIGURE 4.7

Report Templates
When designing reports, the option is available to work from several templates in the standard Microsoft Dynamics AX 2009 application or to create a new template. When applying a template to a report design, several layout elements built into the template are automatically received. A template can include the following: Page numbers on each page A specific company logo A specific disclaimer required for all reports

If reports share the same template, apply changes to the report template. The changes are inherited by the reports using this template. Inheritance of report elements is a significant advantage for report design because many elements of a report are repetitive. Using a report template eliminates redesigning report sections as headers, disclaimers, and other typically used elements.

4-12

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 4: Report Adjustments


Only reports based on an auto design specification inherit changes that are made to a report template. If a report uses a custom design, it does not inherit changes, even though the report is based on a template. When creating the custom design, MorphX took a snapshot of the template and copied it to the Design node of the report. Therefore, a custom designed report cannot be created and a report template cannot be attached to it.

Creating a Report Template


Create a new report template for displaying the name of a company. The best way to accomplish this is to use a Prolog section within a report template.

Demonstration: Create and Attach a Report Template


After creating the template, have the MyReport report use it. This gives it the same properties and methods as the template. 1. Create a new report template by right-clicking the Report templates icon in the Reports branch, and selecting New Report Template. Rename this new template MyProlog. 2. Next, add a Prolog section to the new template. Because a prolog is a section that prints before the page header of the first page of the report, the company name is displayed at the start of the report. Right-click the MyProlog template and select a new Prolog. 3. Add a company name by adding a string control to the Prolog. Rename this new control CompanyName. 4. To view the Company Name, create a display method on this report. 5. Right-click the Methods node and select New Method. 6. This opens the Code Editor where all X++ code is written. Type code in the Code Editor.

FIGURE 4.8 CODE EDITOR

7. Save the method and close the Code Editor. 8. To view the value returned from the display method, attach the method to the CompanyName control on the Prolog by assigning the DataMethod property the value of CompanyName. 9. Because this is on the front of the report, make the font size of this control larger. Set the FontSize property to 20.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

4-13

Development I in Microsoft Dynamics AX 2009


This process has now successfully created a report template that can be used by other reports for adding a prolog to display the company's name. The next step is to extend the template properties to a report. To accomplish this step, attach the MyProlog report template to the MyReport report. 1. Locate the ReportDesign1 node under the MyReport report node in the AOT. 2. In the properties sheet, set the value of the Report Template property to MyProlog. The AutoDesignSpec inherits the properties of the MyProlog template. This means that any time the auto generated report runs for AssetGroupListing, it contains a Prolog section that shows the CompanyName field. Test by opening MyReport from the AOT. The company's name should now appear at the top of the page. NOTE: This Demonstration requires more complex programming knowledge with X++; this exercise gives enough information to continue with the exercise. Writing display methods and other X++ code are covered in more advanced X++ programming courses.

Section Templates
Section Templates make it possible to define sections one time and reuse them many times. Typically this is used for elements appearing in more than one report. For example, a customer wants to customize the layout of all checks printed from Microsoft Dynamics AX 2009. Instead of changing all the reports that print a check, change only the check section template.

Demonstration: Create and Attach a Section Template


The following demonstration shows the steps to create a new section template. 1. Create a new section template by right-clicking the Section Templates node and selecting New Section Template. Rename this section template MyContactSectionTemplate. 2. Add a new body to the section template by right-clicking it and selecting New. The body contains all the changes to the section of the report being modified. 3. Set the Map property of the Section Template Body to CustVendTable.

4-14

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 4: Report Adjustments


4. Add a new field by right-clicking the section template body and clicking New Control then Field from CustVendTable. 5. Add the fields Currency and CreditMax to the Section Template Body. The section template is now defined; link it to a report. 1. Locate the AutoDesignSpecs node under the MyReport report in the AOT and link this section template. Right-click this node and select New > Section Template. 2. Assign the correct properties to the Section Template Pointer. Set the Section Template property to MyContactSectionTemplate and the Table property to CustTable. 3. Save the changes. The section template is now linked to the MyReport report. View the report to verify the additional Currency and Credit Max fields are in the middle of each section.

Paper Format
When running a report in Microsoft Dynamics AX 2009, the paper format must be specified for each report type. For example, open the Accounts Receivable module, then Setup, then Forms, and open Form setup. On the Packing slip tab, in the Layout section, view an example of where the Paper format can be specified. Microsoft Dynamics AX 2009 reports use three standard paper formats: Blank Paper - This is used when nothing is pre-printed on the paper for the report. This choice gives the user a Header, optionally a logo, and all system labels assigned to the printed system data. Partly preprinted or Semi preprinted - This is used for paper without a header. This choice gives the user no Header, but gives all system labels assigned to the printed system data. Preprinted - This option is used if the user does not want anything except the system data printed on the report. This choice gives the user no Header and no labels.

Summary
This course discussed the Microsoft Dynamics AX 2009 techniques for generating a report from the database as a printed document. The location in the AOT of all reports is shown to allow access to adjust and create report elements. This course also discussed tools such as the Visual Report Designer, Templates and MorphX which are used to allow adjustments of report layouts.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

4-15

Development I in Microsoft Dynamics AX 2009

Test Your Knowledge


Test your knowledge with the following questions. 1. What are the three major components that constitute a Microsoft Dynamics AX 2009 report? Mark all that apply. (Select all that apply.) ( ) Designs ( ) Datasources ( ) Methods ( ) Layouts between an AutoDesign specification and a custom GeneratedDesign specification?

2. contain which items? Mark all that apply. (Select all that apply.) ( ) Bodies ( ) Footers ( ) Headers ( ) Page Footers What are some features of the Visual Report Designer that make it an ideal choice for designing reports?

4-16

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 4: Report Adjustments

Quick Interaction: Lessons Learned


Take a moment and write down three key points you have learned from this chapter: 1.

2.

3.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

4-17

Development I in Microsoft Dynamics AX 2009

Solutions
Test Your Knowledge
1. What are the three major components that constitute a Microsoft Dynamics AX 2009 report? Mark all that apply. (Select all that apply.) () Designs () Datasources () Methods ( ) Layouts 2. What is the difference between an AutoDesign specification and a custom GeneratedDesign specification? MODEL ANSWER - When you are using AutoDesignSpecs, the report layout is generated when the report is run. Its content and layout are based on the query used for the report. In a GeneratedDesign the layout is dictated by its design structure that is created in the Visual Report Designer and not by a query or report template. 3. A Section group can contain which items? Mark all that apply. (Select all that apply.) () Bodies () Footers () Headers ( ) Page Footers 4. What are some features of the Visual Report Designer that make it an ideal choice for designing reports? MODEL ANSWER - The Visual Report Designer allows you to drag and drop report field elements for placement in the report. It allows you to change the scaling while in design mode so you can place your objects more accurately.

4-18

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Appendix A: Extending Microsoft Dynamics AX 2009 - A Case Study

APPENDIX A: EXTENDING MICROSOFT DYNAMICS AX 2009 - A CASE STUDY


Objectives
The objectives are: Demonstrate skills for designing Tables. Demonstrate skills for designing and creating Tables and Relations. Demonstrate skills for designing and creating Extended data types. Demonstrate skills for designing and creating Base enumerations. Demonstrate skills for designing and creating Basic forms. Demonstrate skills for designing and creating Reports. Demonstrate skills for designing and creating Menus. Demonstrate skills for designing and creating Menu items.

Introduction
The Contoso Entertainment Systems has been operating and providing outstanding service to its customers for over 50 years. Recently, customer communication issues have arisen in the Accounts Receivable Department. Customers have complained that the level of service they receive from the Contoso Entertainment Systems Company has not been satisfactory. The department manager has decided the best way to handle this problem is to create a customer contact log. By keeping a log, the manager feels that customer service will improve. As a Microsoft Dynamics AX 2009 developer for the Contoso Entertainment Systems, it is your responsibility to add this functionality to Microsoft Dynamics AX 2009. The goal of the case study is to create an application called the Customer Contact log. The log will track the medium used to contact the customer, such as e-mail, telephone, or mail, and last contact date, and a note about the issue. The Contoso Entertainment Systems Company hopes that by keeping this log, customer communication will no longer be an issue.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

A-1

Development I in Microsoft Dynamics AX 2009

Metadata Design
In Part 1, create the basic metadata design necessary for the Customer Contact log.

Decide on the Information Fields


First, decide which information fields will be used based on managerial requirements. Then assign the appropriate data types to the fields.

Management's Information Requirements


Customer Service Representatives require the following fields to enter and view contacts: Account Number Contact Name Contact Date Contact Type Contact Notes

Creating metadata involves building data dictionaries that define entity relationships, primary and foreign key relations, and the assignment of data types. Accomplish the metadata design, using familiarity with the CustTable table, by creating a single new table within the Microsoft Dynamics AX 2009 Data Dictionary.

Notes on Contact Methods


The contact type field contains a set of defined values that enumerate the methods by which Customer Service can contact customers. These methods are as follows: Mail E-Mail Telephone Other methods such as FAX are not enabled

Basic Table Planning


To start an initial plan for building the table, all the information displayed on the form is new information, except the account number. This gives a starting point based on best practices. Plan to create a table that uses a relation to display account number information. The information for the other fields must be entered by the Customer Service Representatives.

A-2

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Appendix A: Extending Microsoft Dynamics AX 2009 - A Case Study


The table serves as the new customer contact log table; name it CustContactLog. This contact log table describes: Contact Date Contact Type Contact person Contact Notes by Account Number

The table holds non-duplicated information about all contacts made by Customer Service Representatives. The form you create shows the data from the new table and serves as the graphical user interface for entering and displaying information about all customer contacts made by Customer Service Representatives.

Assigning Data Types


Before creating the table, assign Microsoft Dynamics AX 2009 primitive and extended data types to the information fields in the project. Open the AOT and start looking for extended data types that can be used for assignment to the data fields in the project. An examination of the Extended Data Types results in the following Metadata plan for Extended Data Types. Data Type Assignments Field Name AccountNumber ContactName ContactDate ContactType ContactNotes Primitive Data Type String String Date Enum String Extended Data Type AccountNum Name DatePhysical You will create this. Notes

An Extended Data Type for ContactType is not apparent using the existing data types. Enter Custom into the table as a place holder to later build an extended data type for the ContactType field.

Field Label Assignments


Note that the Label property is inherited from the extended data type. Adjustments to these values may be required if they do not serve the intended goal of the project.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

A-3

Development I in Microsoft Dynamics AX 2009

Creating the Basic Data Objects


In Part 1, the Data Dictionary objects were defined (metadata plan). Part 2, the metadata plan will be developed using MorphX, and store all the created objects in a Project.

Create a Project
Create a project to store all the application objects that are created throughout this project. Projects are an important organizational tool when developing in Microsoft Dynamics. Create one here to store all the application objects. 1. Open the Projects tree from the icon on the toolbar and expand the Private node. 2. Right-click the Private node and select NEW -> PROJECT. Rename the project CustContactLogProject. After creating an object in the AOT during this Case Study, drag it from the AOT and drop it on the project node. In this manner, when modifying the customization later, it is easier to find all the relevant application objects. This action creates a link to the object in the AOT.

Creating the Base Enumeration for the Contact Type


Because the data field holding information about the contact type is a list, create a base enumeration that contains all the ways a customer can be contacted. 1. Create a new Base Enumeration by right-clicking the Base Enums node and selecting New Base Enum. Name this base enum ContactMethods with a Label property of Contact Methods. 2. To add elements to the new Base Enumeration right-click and select New Element. 3. Add three elements to this base enum. o Name: Mail, Label: Mail o Name: Email, Label: Email o Name: Phone, Label: Phone 4. Reset the EnumValue properties of these elements as follows: o Mail: EnumValue = 1 o Email: EnumValue = 2

A-4

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Appendix A: Extending Microsoft Dynamics AX 2009 - A Case Study


5. Phone: EnumValue = 3By not using the EnumValue 0, the default value of the Enum is blank rather than Mail. 6. The following figure illustrates the expected appearance of the final ContactMethods enumeration:

FIGURE A.1 CONTACTMETHODS ENUMERATION

7. Save the ContactMethods base enumeration. 8. Next, create an extended data type for the ContactMethods base enumeration that can be assigned to the ContactType field.

Creating an Extended Data Type


1. To create a new Enum extended data, right-click Extended Data Types and select NEWENUM. 2. Open the properties sheet to set its Name, Label, and EnumType properties. o The Name is ContactTypes. o The Label property is Contact Types. o The EnumType property is ContactMethods. 3. Save the changes. 4. This completes the extended data type for the ContactTypes field in the Customer Contact Log table.

Table Creation
1. Start with creating the table. Open the Tables branch and select the New Table method. Rename the table CustContactLog. 2. Create a String field named AccountNumber. Give this field an extended data type of AccountNum. 3. Create a String field named ContactName. Give this field an extended data type of Name. 4. Create a Date field named ContactDate. Give this field an extended data type of DatePhysical. 5. Create an Enum field named ContactType. Assign this field the ContactTypes extended data type created in the previous exercise. 6. The last field to create is the ContactNotes field. Assign this field the Notes extended data type.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

A-5

Development I in Microsoft Dynamics AX 2009


As soon as the extended data type is saved to the ContactNotes field, notice that the value of the StringSize property is set to Memo. This property is inherited from the extended data type. NOTE: Here are a few points about the memo StringSize property: Memo indicates the field is unlimited in length. Memo fields : o o o Cannot perform free text search. Cannot be used in an index. Negatively impact performance during fetch operations.

Memo fields CANNOT be used in WHERE clauses.

NOTE: To understand more about Memo data types consult the Microsoft Dynamics AX 2009 Developer Help.

FIGURE A.2 HOW THE FRAMEWORK APPEARS

7. Synchronize the table by right-clicking the table and selecting Synchronize.

Creating the Account Number Relation


The next step is to assign the Relation between the AccountNumber field in CustContactLog table and the system customer table, CustTable. 1. Right-click the Relations node under the CustContactLog table and select New Relation. 2. Because the new Relation uses the customer table named CustTable, set the Table property to CustTable. Leave the Validate property set to its default of Yes.

A-6

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Appendix A: Extending Microsoft Dynamics AX 2009 - A Case Study


The framework for the Relation is already created. The next step is to assign a specific relationship between fields in the customer table and the new contact log table. 3. Create a Normal relation by right-clicking on the Relation1 node and selecting NEWNORMAL. 4. Set the Field property and the RelatedField property of this relation. The Field property refers to the CustContactLog table and the RelatedField property refers to the relating field in CustTable. Equate the AccountNumber field in the table to the AccountNum field in the CustTable. The following figure illustrates the complete framework after assigning the relationship.

FIGURE A.3 COMPLETE FRAMEWORK

5. To test that the table is created correctly, view the table in the Table Browser. Review the section titled Viewing and Searching Data in Microsoft Dynamics AX 2009 Tables in Course 2 for more information.

Creating the Graphical Components


In Part 2, the data dictionary objects necessary to store information for the customer contact log were created. In Part 3 of this case study, the customer contact log graphical interface will be designed and created. This will include creating forms, menu items, and menus using MorphX.

Designing the Form


Management wants a simple form that displays all the information in your customer contact log. The fields to be displayed are shown in the following list.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

A-7

Development I in Microsoft Dynamics AX 2009


Display Fields
The display fields in the form are based on the Customer Contact Log table and the system Customer table. Account Number Contact Name Contact Date Contact Type Contact Notes Company Name Address

Creating the Form


Create a new form that displays customer contact information to the customer service agents within the company. 1. Right-click the Forms branch and select New Form. Rename the form CustomerContactLog. 2. Set the Caption property of the design of the form to Customer Contact Log. Add a data sources to the form. 3. Open the Tables node in the AOT in a new window to drag new data sources onto this form. Locate the CustContactLog table and drag it onto the Data Sources node. Also add the CustTable as a data source. 4. Set the JoinSource property on the CustTable data source to CustContactLog. Leave the LinkType property at Delayed. The data sources for the new form have been added; the next step is to create a design for the form. 5. Right-click the Design node and select NEW CONTROLGRID. 6. Open the Data Sources of the form in a New Window. Drag the following fields onto the grid: From CustContactLog: AccountNumber ContactName ContactData ContactType ContactNotes

A-8

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Appendix A: Extending Microsoft Dynamics AX 2009 - A Case Study


From CustTable: Name Address The following figure illustrates the form AOT design. 7. A few labels on the grid fields must be overwritten in this design. Set the Label property for each field as outlined below: o CustTable_Name: Company Name o CustContactLog_ContactName: Contact Name o CustContactLog_ContactDate: Contact Date o CustContactLog_ContactType: Contact Type o CustContactLog_ContactNotes: Contact Notes 8. To make the form resizable, two properties must be changed on the Grid control of the design. Set the Width property to Column Width and the Height property to Column Height.

Creating the Report


Not only does the companys management want to view data in a form, but they also want the ability to create a report output. Create an Auto Design specifications report to display this information. 1. Create a new report and name it CustContacts. 2. The data sources on the query of this report resemble the ones on the Form created earlier. 3. Add the CustContactLog table to the Data Sources node of the Query. 4. Add the CustTable table to the Data Sources node of the CustContactLog_1 data source node. 5. Create a relation on the CustTable data source relating the AccountNumber field in the CustContactLog table to the AccountNum field in the CustTable.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

A-9

Development I in Microsoft Dynamics AX 2009


The following figure illustrates the updated AOT design.

FIGURE A.4 UPDATED FORM AOT DESIGN

Now that the data sources for this report are added, create the design. 1. First, right-click the Design node of the report and select New Report Design. 2. Expand the ReportDesign1 node to reveal the AutoDesignSpecs node. Right-click and select Generate Specs from Query. This adds two Body sections to the design, one for each data source in the query. 3. Add the fields shown in the following figure to each of the Body sections.

FIGURE A.5 ADDING FIELDS TO THE BODY SECTION

4. Some of the labels on these fields must be changed. Change the

A-10

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Appendix A: Extending Microsoft Dynamics AX 2009 - A Case Study


5. Open the report from the AOT to assess its design. 6. To make the report easier to read, add a dashed line in between each block of customer data. Set the LineBelow property on the CustTable_Body section to ShortDashes. 7. Attach an existing template to this report. Set the ReportTemplate property of the ReportDesign1 node to FrontPage. This figure illustrates the final report.

FIGURE A.6 FINAL REPORT

Creating a Menu Item


The Form and Report for the Customer Contact Log project are completed. It is now time to create menu items that display the form and the report. After creating the Menu Items, add them to an existing Menu. First, create the menu item for the form. 1. To open a form from a menu item, create a new Display menu item. Rename this menu item ContactLog. 2. On the properties sheet for the new Display Menu Item set the Class property to Form and the Object property to CustomerContactLog. 3. The label property for a menu item is very important. This is the text the user views in the application. Set the label property for this Menu Item to be Customer Contacts. 4. Save the new menu item. 5. To open a report from a menu item, create a new Output menu item. On the Output node under Menu Items in the AOT, right-click and select New Menu Item. Rename this CustContacts. 6. On the properties sheet for the new Output Menu Item set the Class property to Report and the Object property to CustContacts. 7. Set the label for this menu item to Customer Contacts Report. Now that there are menu items, attach them to a menu.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

A-11

Development I in Microsoft Dynamics AX 2009


Creating a New Menu and Attaching Menu Items
This section describes creating a new menu that will be added to the Navigation Pane of the Microsoft Dynamics AX 2009 application. 1. Right-click the Menus node in the AOT and select NEWMENU. Give this menu a name of CustomerService and a label of Customer Service. 2. Add the two menu items created earlier using the drag technique. The following figure illustrates the menu structure in the AOT:

FIGURE A.7 MENU STRUCTURE IN THE AOT

3. The final step is to add the CustomerService menu as a reference on the main menu. Right-click the MainMenu menu in the AOT and select NEWMENU REFERENCE. 4. Drag the CustomerService menu reference onto the MainMenu. 5. To view the changes to the navigation pane, close and reopen the navigation pane. Reopen the navigation pane using the icon on the toolbar shown in the following figure.

FIGURE 99.8 OPENING THE NAVIGATION PANE FROM THE TOOLBAR

6. The Customer Contact Log project is now completed, and is ready for use.

A-12

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Appendix A: Extending Microsoft Dynamics AX 2009 - A Case Study

Summary
This Case Study did a walk-through of how to develop a full project without needing to write a single line of code. The first part of the Case Study reviewed the tasks required to define the Metadata for the rest of the case study. The second part of the Case Study reviewed the steps required to build the data dictionary objects necessary to store information for the customer contact log that was created. The last part of this case study reviewed the steps required to build the customer contact log graphical interface, including forms, menu items, and menus developed using MorphX.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

A-13

Development I in Microsoft Dynamics AX 2009

Quick Interaction: Lessons Learned


Take a moment and write down three key points you have learned from this case study: 1.

2.

3.

A-14

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

You might also like