Vous êtes sur la page 1sur 110

COURSE: 80303

DEVELOPMENT I
IN MICROSOFT DYNAMICS AX 2012

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Last Revision: July 2011


This courseware is provided as-is. Information and views expressed in this courseware, including URL and other
Internet Web site references, may change without notice.
Unless otherwise noted, the examples depicted herein are provided for illustration only and are fictitious. No real
association or connection is intended or should be inferred.
This courseware does not provide you with any legal rights to any intellectual property in any Microsoft product.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under
copyright, no part of this courseware may be reproduced, stored in or introduced into a retrieval system, or
transmitted in any form or by any means or for any purpose, without the express written permission of Microsoft
Corporation.
Copyright 2011 Microsoft Corporation. All rights reserved.
Microsoft, Microsoft Dynamics, Microsoft PowerPoint, Microsoft SQL Server data management software
and Microsoft Dynamics AX are trademarks of the Microsoft group of companies. All other trademarks are
property of their respective owners.
This course content is designed for Microsoft Dynamics AX 2012.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Table of Contents
Introduction

0-1

Welcome ............................................................................................................ 0-1


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

Chapter 1: Architecture

1-1

Objectives ........................................................................................................... 1-1


Introduction ......................................................................................................... 1-1
Features of Microsoft Dynamics AX ................................................................... 1-2
Architecture ........................................................................................................ 1-4
Development Environments ............................................................................... 1-8
Model Driven Architecture ................................................................................ 1-13
Lab 1.1 - Create a New Model and Development Project ................................ 1-18
Licensing and Configuration ............................................................................. 1-19
Summary .......................................................................................................... 1-20
Test Your Knowledge ....................................................................................... 1-21
Quick Interaction: Lessons Learned ................................................................. 1-23
Solutions ........................................................................................................... 1-24

Chapter 2: Data Dictionary

2-1

Objectives ........................................................................................................... 2-1


Introduction ......................................................................................................... 2-1
MorphX and the Application Object Tree............................................................ 2-2
Tables ................................................................................................................. 2-6
Data Types: Primitive and Extended ................................................................ 2-11
Lab 2.1 - Create a New EDT ............................................................................ 2-15
Creating Tables ................................................................................................ 2-16
Lab 2.2 - Create a New Table .......................................................................... 2-18
Indexes ............................................................................................................. 2-19
Lab 2.3 - Create a Primary Index ..................................................................... 2-21
Relations .......................................................................................................... 2-22
Lab 2.4 - Create a Relation .............................................................................. 2-24
Base Enumerations .......................................................................................... 2-26
Lab 2.5 - Add an Enum .................................................................................... 2-27
Views ................................................................................................................ 2-28
Summary .......................................................................................................... 2-28
Test Your Knowledge ....................................................................................... 2-29
Quick Interaction: Lessons Learned ................................................................. 2-30
Solutions ........................................................................................................... 2-31

Chapter 3: User Interfaces

3-1

Objectives ........................................................................................................... 3-1


Introduction ......................................................................................................... 3-1
Forms ................................................................................................................. 3-2
Lab 3.1 - Create a Form ................................................................................... 3-11
Joining Data Sources ....................................................................................... 3-12
Menus Items ..................................................................................................... 3-13
Form Templates ............................................................................................... 3-15

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 2012


Lab 3.2 - Create a Form from a Template ........................................................ 3-16
List Pages ......................................................................................................... 3-17
FactBoxes ........................................................................................................ 3-19
Summary .......................................................................................................... 3-21
Test Your Knowledge ....................................................................................... 3-22
Quick Interaction: Lessons Learned ................................................................. 3-23
Solutions ........................................................................................................... 3-24

Chapter 4: Security

4-1

Objectives ........................................................................................................... 4-1


Introduction ......................................................................................................... 4-1
Definitions ........................................................................................................... 4-2
Set Up a New User ............................................................................................. 4-5
Assign a User to a Role ...................................................................................... 4-6
Change Duties on a Role ................................................................................... 4-8
Change Privileges on a Duty .............................................................................. 4-9
Assign a Permission to a Privilege ................................................................... 4-12
Investigate Access ........................................................................................... 4-12
Lab 4.1 - Create a New Security Role .............................................................. 4-14
Summary .......................................................................................................... 4-16
Test Your Knowledge ....................................................................................... 4-17
Quick Interaction: Lessons Learned ................................................................. 4-18

ii

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Introduction

INTRODUCTION
Welcome
We know training is a vital component of retaining the value of your Microsoft
Dynamics AX 2012. 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 2012

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 2012

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: Architecture

CHAPTER 1: ARCHITECTURE
Objectives
The objectives are:

Describe the basic features of Microsoft Dynamics AX 2012.

Review basic form navigation.

Review the architecture of Microsoft Dynamics AX 2012.

Describe the options for making development changes in Microsoft


Dynamics AX 2012.

Describe the theory of Model Driven Architecture in Microsoft


Dynamics AX 2012.

Review licensing and configuration.

Introduction
Microsoft Dynamics AX 2012 is a customizable, multiple-language, and
multiple-currency Enterprise Resource Planning (ERP) solution. Microsoft
Dynamics AX excels in:

Manufacturing.

E-business.

Wholesale.

Services industries.

Microsoft Dynamics AX is a completely integrated solution and is web-enabled


and supports Microsoft SQL Server. 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 2012

Features of Microsoft Dynamics AX


Microsoft Dynamics AX is a unique and powerful solution that contains
functional and development environment features, which include the following:

Functional features
o
o
o
o
o

Single database architecture is used for all companies in the


organization.
Highly integrated design between functional areas such as
resource planning, sales, and manufacturing.
Dimension-based system for all modules.
Advanced features such as Forecasting and Master Planning are
available.
Multi-currency and Multi-language capabilities.

Development environment features


o
o
o
o
o

Microsoft Dynamics AX MorphX is an integrated development


environment (IDE) for developing in Microsoft Dynamics AX.
Visual Studio is an alternative development environment for
web, report and managed code development.
The Application Object Tree (AOT) provides a uniform and
compact viewing repository.
Drag-and-drop functionality is supported for many programming
tasks.
Projects help organize and track customized applications in
Microsoft Dynamics AX.

Client Workspace
The client workspace is the standard rich client interface that an end-user uses.
The workspace consists of various components:

Navigation Pane
The Navigation pane is the menu on the left side of the screen that shows all of
the modules the current user has access to.

Content Pane
The content pane displays role centers, list pages and area pages.

1-2

Role centers display specific data, reports, alerts, and common tasks
associated with a user's role in the organization. The role center is
displayed when an end-user opens the application or goes to Home in
the Navigation pane.

List pages display lists of data. They are optimized to view and
search through a list of records and act on information.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture

Area pages display all menu items relevant to the module selected in
the Navigation pane. They are grouped logically to make it easier for
end-users to find what they need.

FIGURE 1.1 WORKSPACE

Customers List Page


In the Navigation pane, click Accounts Receivable > Common > Customers >
All customers. This brings up a list of all customers in the system.
In the center of the form is a grid that displays a list of customers. At the top of
the screen is the Action Pane that contains buttons to open other forms and take
actions related to the selected customer. On the right are FactBoxes that show
data related to the selected customer.
To create a new customer, click New > Customer in the Action Pane. A new
form opens where you can enter data for the new customer. Fields with a red
wavy line are mandatory.

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 2012


In the grid on the list of customers, click the field header of the Customer
account field. Doing this sorts the data by customer account number order.

FIGURE 1.2 CUSTOMER LIST PAGE

Architecture
Microsoft Dynamics AX has a three-tier architecture.

Three-Tier Architecture
Three-tier architecture is defined as having a separate database, server and client
where:

The database stores the data.

The server runs the application business logic.

The client application allows users to connect to the server to access


business logic and use the data in the database.

In Microsoft Dynamics AX the three tiers include the following:

1-4

A SQL Server Database that houses the data entered into, and used
by, the Microsoft Dynamics AX application. It also houses the model
store that contains the application elements. (Application elements
are explained in the following lesson)

An Application Object Server (AOS) is a service that runs most of


the business logic. This runs continuously on a central server.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture

The Client application is the user interface through which an enduser accesses Microsoft Dynamics AX. There are various clients
available including the Microsoft Dynamics AX rich client and
Enterprise Portal.

FIGURE 1.3 THREE TIER ARCHITECTURE

Extended Architecture
Several other components of the Microsoft technology stack are used in a typical
deployment.
Reports are delivered by SQL Reporting Services (SSRS). SSRS is a component
included in SQL Server.
Business Intelligence (BI) components such as Key Performance Indicators use
Online Analytical Processing (OLAP) cubes which are delivered by SQL
Analysis Services (SSAS). SSAS is a component included in SQL Server.
The Enterprise Portal and Role Pages are hosted in SharePoint. There are two
versions of SharePoint that can be used. Window SharePoint Foundation 2010 is
a free download. Microsoft SharePoint Server 2010 is a product that can be
purchased to provide extended collaboration and content management tools.
Integration to other applications or to third party organizations might require
integration solutions such as web services.

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 2012


The following image describes a typical system architecture that includes other
components of the Microsoft technology stack.

FIGURE 1.4 EXTENDED ARCHITECTURE

SQL Server Databases


Microsoft Dynamics AX Database
The Microsoft Dynamics AX database is an Online Transactional Processing
(OLTP) database that stores all the business data in SQL tables.
This database also stores all of the metadata and application code in the Model
Store.

Business Intelligence (BI) Databases


Some BI components of Microsoft Dynamics AX also require you to use SSRS
and SSAS. The SSAS database is replicated from the OLTP database in a
database format that is optimized for fast reporting and analysis.

1-6

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture
Application Object Server
The Application Object Server (AOS) is the Microsoft Dynamics AX
application server. The AOS is where most of the business logic is executed.
The AOS performs many tasks. Some of the most important tasks include:

X++ runtime: It runs the X++ code which provides most of the
business logic in Microsoft Dynamics AX.

Security: It enforces security to manage access to data and


functionality.

Session management: It manages client sessions.

Web services: It is a web service endpoint.

Multiple AOS's can be installed to spread the processing load over multiple
servers. This improves performance in larger implementations.

Clients
Microsoft Dynamics AX Rich Client is the primary client to access Microsoft
Dynamics AX functionality. Most forms displayed in the rich client are designed
by using the MorphX development environment. Role center pages are
SharePoint pages that are displayed within a rich client form. SQL reports are
called from the rich client by using the report viewer control.
Enterprise Portal pages are displayed through a web browser. A subset of
functionality and reports are available on the portal.
Microsoft Office can be used as a client to access the Microsoft Dynamics AX
application and data. Office add-ins are available out-of-the-box for Microsoft
Excel and Microsoft Word.
Other Applications can be used as a client to the Microsoft Dynamics AX
application. Examples include mobile applications, specialized applications
written in .net and legacy applications. Applications can be integrated using
methods such as web services or the .net business connector.
The .NET Business Connector is a client that has no user interface. It is
designed for other applications to access the Microsoft Dynamics AX business
logic. End-users can use another application as the user interface that interacts
with the AOS through the .net Business Connector.
Developers can access the developer tools through the MorphX IDE in the
Microsoft Dynamics AX client or through Visual Studio Tools in Visual Studio.

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 2012


Other Components
Internet Information Server (IIS)
IIS is a web server that delivers content such as web pages.

Enterprise Portal and SharePoint


IIS is required to host the Enterprise Portal framework within SharePoint. Role
Centers require the Enterprise Portal regardless of whether they are viewed
through the web browser or the Microsoft Dynamics AX Windows Client.

Help Server
Microsoft Dynamics AX Help files are hosted through IIS. When a user accesses
Help from within the rich client, the AOS generates a call to the Help server to
display the Help pages.

Web Services
Web Services are hosted within IIS. The AOS is the web service endpoint that
provides the data that is served to other applications by IIS in a standardized
format.

Development Environments
The Microsoft Dynamics AX application is built of elements that are stored in
the model store in the SQL Service database. For example, the following element
types make up part of the application:

Fields and Tables define data structure.

Forms and Menus define how a user interacts with the application.

Classes and Methods are code objects that define business logic.

The Application Object Tree (AOT) provides a visual representation of the


elements that comprise the application.
Object-oriented design and Inheritance are key concepts that form the basis of
the application.

1-8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture
Model elements can be modified or added using a development environment. The
development environments that can be used with Microsoft Dynamics AX 2012
include:

Microsoft Visual Studio.

Microsoft Dynamics AX Integrated Development Environment


(IDE). This is also referred to as the MorphX IDE and is accessed
through the developer workspace in the Microsoft Dynamics AX
client.

A white paper titled "Selecting the Best Development Technology for your
Application Development Scenario AX2012" is available for download on
MSDN.

Application Object Tree


A full definition of all the element types in Application Object Tree (AOT) can
be found in the development training material and developer Help files. Some of
the root element types include:

Data Dictionary contains objects that define basic data structure.


o

Tables contain a group of associated fields. For example the


CustTable contains fields relevant to customers. Fields on a table
contain individual pieces of data. For example, AccountNum
contains the customer account number. Fields on a table inherit
properties from extended data types.
Extended data types define a data type and extended properties.
There are various basic data types such as a string, integer, date,
time and enum. For example, AccountNum is a string extended
with properties including a length of 20 characters, left justified
and is mandatory.
Base Enums are enumerated text data types. These are
predefined text values that are referenced by an integer value in
the database. These are presented to the user as a fixed list of
options. For example, Blocked is an enum that gives the user
only two options (yes or no) as to whether a customer account is
on hold.

Classes contain code that is used in the application.

Forms define the layout of all of the forms. Forms are used to view
data in the Microsoft Dynamics AX client.

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 2012

Visual Studio Projects display any development projects created in


Visual Studio.

Menus define forms and reports that appear in the menu in the
Microsoft Dynamics AX rich client.

FIGURE 1.5 AOT DISPLAYED IN THE DEVELOPER WORKSPACE

Labels
Labels are used to provide the language text that end-users see when using the
application. All text presented in the client displays the translation of a label
code. The label codes usually are reused wherever the exact same text is used
with the same meaning. This makes it easier to manage multiple languages and to
adapt to company specific language.
As an example:

1-10

The label code @SYS78211 is translated as "Direct delivery" in the


English-US label file. This label code is used in various places
throughout the application. It is used on field names and menu items
displayed on forms such as the Sales Order Header form.

All label codes are already translated into all other languages in
which Microsoft Dynamics AX is available. This label code is
translated as "Entrega directa" in the Spanish label file. If an enduser opens the application in Spanish, they will see the Spanish
translation wherever this label code is used.

Developers can create new label files to translate label codes into
other languages or customer specific terminology. Tools, including
the label editor and label wizard, are available within the MorphX
development environment to add or change label files.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture
MorphX IDE
The MorphX IDE is accessed through the Developer Workspace which provides
access to the AOT and other developer tools. It is used to make changes and add
to the application. This is the most commonly used development environment.
Common operations such as building or modifying tables, forms and menus can
be performed by using drag-and-drop techniques with little or no coding. X++ is
the programming language that is used in the MorphX IDE to write more
advanced business logic.
You can access the MorphX IDE from the Microsoft Dynamics AX client. Click
the Windows menu in the command bar and select New Developer Workspace.
Alternatively you can use the shortcut keys Ctrl+Shift+W.

X++ Tools
X++ is the object-oriented programming language that is used in the MorphX
development environment. X++ has C#-like syntax, and incorporates SQL data
manipulation statements.
A full list of developer tools in the MorphX development environment can be
found in the developer help documentation. Some of the tools available include:

The X++ Code Editor is a text editor used to write X++ code. It
supports color-coding and allows to look up and select various
objects such as method names and enumeration values as you type.

The Debugger is an application used by developers to step through


X++ code to help resolve code errors.

The Reverse Engineering tool enables you to visualize data and


classes in Microsoft Dynamics AX by creating UML data models,
UML object models, and ERX ER data models.

The Table browser displays data from all fields in a selected table.
The table browser can be used to run SQL statements.

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 2012


NOTE: Extreme care must be taken when updating records in the table browser.
It should be regarded as a development and testing tool. It is always better
practice to update data from the Microsoft Dynamics AX client.

FIGURE 1.6 X++ CODE EDITOR

Visual Studio
The Visual Studio development environment is integrated through Visual Studio
Tools for Microsoft Dynamics AX (Visual Studio Tools) and it supports
managed code.
Close integration between MorphX and Visual Studio means developers can take
advantage of the benefits of each development tool and work in the environment
that best suits their development scenario.
Some development scenarios must take place in Visual Studio. This includes
creating and customizing SSRS reports, most Enterprise Portal web development
and any managed code development.

1-12

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture
The Application Explorer is available within Visual Studio. This gives
developers the ability to browse AX metadata. The Application Explorer displays
information that is similar to the AOT in the MorphX IDE. Visual Studio projects
are displayed in the AOT and are stored in the Microsoft Dynamics AX model
store in SQL server.

FIGURE 1.7 APPLICATION EXPLORER IN VISUAL STUDIO

Development Projects
While developing in Microsoft Dynamics AX, you can group all your
modifications in to a development project. To create a new development project,
click the project icon in the development workspace, or press Ctrl-Shift-P.
Private projects are visible to the user creating them and shared project are
visible to everyone.
To create a new shared project:

Right-click the Shared node and select New > Project.

Give the project a descriptive name and then double-click it to open


it. Now any elements from the AOT can be dragged in to this project.
This creates a reference to the element. Modifying elements in the
project is the same as modifying them directly in the AOT.

Model Driven Architecture


Microsoft Dynamics AX is designed with a unique layer and model structure that
separates and controls the updates and modifications made in the application.
This structure provides a powerful and flexible architecture for developing
business logic.

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 2012


The key benefit of the layer and model structure is that it lets developers change
and extend the functionality in Microsoft Dynamics AX while maintaining
upgradability to new versions.

Layers
Application object layers hold all elements that are displayed in the AOT. There
are eight application object layers available. Each of these layers also has a patch
layer making a total of sixteen layers.
Layers are a hierarchy of levels in the application you can use to make
modifications and additions without interfering with the application elements in
the next lower level. When you make an element modification on one level, the
modification overshadows the element on a lower level. When the application is
compiled, only the top-level version of an application element is used.
There are three layers available only to Microsoft to deliver the base application.
(The xxP layer indicates the patch layer for each application object layer).
Layer

Description

SYS, SYP

System layer: The standard application is developed in this


lowest layer. This includes the core application and the
localization for most countries.

GLS, GLP

Globalization layer: Includes features developed for some


countries that were not yet moved into the SYS layer.

FPK, FPP

Feature Pack layer: Includes industry feature packs that are


controlled by Microsoft.

There are three layers available to partners and ISVs.

1-14

Layer

Description

SLN, SLP

Solution layer: Includes Microsoft endorsed industry solutions.

ISV, ISP

Independent Software Vendor layer: Includes generic or


vertical solutions developed by ISV's.

VAR,
VAP

Value Added Reseller layer: Includes multi-customer solutions


developed by VAR's.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture
There are two layers available to both partners and customers who have a license
to access the AX source code.
Layer

Description

CUS, CUP

Customer layer: Includes customer specific functionality.

USR, USP

User layer: Includes installation specific functionality and


customizations.

FIGURE 1.8 APPLICATION LAYERS

Benefits of Layers: Source Code Protection


The elements in the standard implementation (SYS, GLS, FPK layers) can only
be changed or deleted by the Microsoft Dynamics AX Development team.
The layers help protect the original source code and keep it separate from
modifications.
Similarly, ISV solution code is separated in a model within the ISV layer. Any
customer specific changes to the ISV solution would be in a higher layer.

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 2012


Benefits of Layers: Faster and Easier Upgrades
Upgrades and service packs contain changes in the lower layers where the base
code resides. This means that any changes by partners or customers are
maintained throughout the upgrade. Powerful compare and merge tools are
available to guide developers through the upgrade. These tools highlight
elements that are modified in higher layers and therefore might require some
action to merge the changes.
As an example:

The item number is an extended data type that exists in the SYS
layer. This field is a string which is 20 characters in length.

If a company that uses Microsoft Dynamics AX requires 30


characters for their item numbers, the field length would be changed
to 30 characters and the change saved in the CUS layer. The item
number data type now exists in both the SYS layer and the CUS
layer. The CUS layer is a higher layer so when the application is
compiled, the 30 character length is used.

If in a future version, Microsoft extends the length of the item field


to 40 characters, the upgrade tool would highlight that there is a
change in the SYS layer to 40 characters and there is an existing
change in the CUS layer to 30 characters. The developer would then
have the option to keep the CUS layer change or delete the CUS
layer and revert to the new field length in the SYS layer of the new
release.

Models
A model is a logical grouping of elements within a layer. Models help in
situations where multiple ISV solutions or projects must operate together. This
architecture allows many solutions to co-exist within each layer.
An element can exist in exactly one model in a layer. The same element can exist
in a customized version in a model in a higher layer. New models are easy to
create in the MorphX IDE and are applied when modifying or adding objects in
the AOT. Models can be exported, installed, or uninstalled from the model store.
Models are identified by a name and a publisher, and have a set of properties that
can be changed, including a version number.
Following is an example:

1-16

A company has two lines of business. They manufacture and sell


medical products. They also manufacture, sell and service
specialized equipment to produce medical products.

Solution A is an advanced vertical solution for the production of


food and drug products. Among other things, this solution adds a
new field to the item table to store the government approval number.
This is stored in the ISV layer and in the model MEDICAL.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture

Solution B is an advanced vertical solution for managing the ongoing


service of equipment which is sold to customers. Among other
things, this solution adds a new field to the item table for the default
service period. This is stored in the ISV layer and in the model
SERVICE.

You can use models to view the modifications to the item table made
by all ISV solutions and easily see where each change originated.

Managing Models
Models can be created in the development workspace by clicking on Tools >
Model management > Create model. Then you can enter the model name, your
company, which layer the model is in, the version number, a full description, and
a shorter description. The combination of name and publisher make a unique
model.

FIGURE 1.9 CREATING A NEW MODEL

To change the current model, click the current model in the status bar.

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 2012

Lab 1.1 - Create a New Model and Development Project


In this lab you will create a model and a development project to keep your
modifications organized. During the remainder of the course, any elements you
modify or create should be added to this project.
Scenario
Isaac, the Systems Developer, needs to make a number of modifications to the
system. He wants to be able to group all the elements he creates and modifies
together in one place, and also make it easy to move the modifications to test and
production systems later.

Challenge Yourself!
Create a model called Dev1 and a development project called Dev1Training

Step by Step
1. Click Tools > Model Management > Create Model.
2. Enter Dev1 in the model name, your name in the publisher and
Dynamics AX Development 1 training labs in the description.
3. Click OK.
4. Click Close on the infolog dialog.
5. Press Ctrl-Shift-P to open the development projects window.
6. Right-click the Shared node and select New > Project.
7. Rename the project to Dev1Training.

1-18

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture

Licensing and Configuration


The basic security architecture in Microsoft Dynamics AX includes license codes
and configuration keys.

License Codes
License codes control the modules that can be used within Microsoft Dynamics
AX. If a license code for a module is not purchased, none of that functionality is
available.

Configuration Keys
Configuration keys in Microsoft Dynamics AX control the functionality and
features in the system. These keys ensure the Microsoft Dynamics AX solution is
not cluttered with functionality companies do not use. Configuration keys have
descriptions to describe the functionality affected by enabling or disabling them.
Each configuration key is attached to a license code, so if the license is not
purchased, the configuration key is unavailable.

FIGURE 1.10 ACCESSING CONFIGURATION KEYS

Each configuration key controls access to a specific feature, and once it is


enabled or disabled, the feature is automatically added or removed in the user
interface. The underlying tables attached to that configuration key still exist in
the database, but are set to be temporary tables, which do not store data.

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 2012

Summary
This course provided a high-level introduction to the Microsoft Dynamics AX
architecture.
The course introduced important terms related to Microsoft Dynamics AX
Development, and it also discussed the user interface and the different ways data
can be presented in forms and reports.
This course also discussed the basic security architecture that includes License
codes and configuration keys.

1-20

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture

Test Your Knowledge


Test your knowledge with the following questions.
1. Microsoft Dynamics AX 2012 has a three-tier architecture. What are the
three tiers and what is the purpose of each tier?

2. What client applications can be used to access Microsoft Dynamics AX


2012? (Select all that apply)
( ) Microsoft Dynamics AX Rich Client
( ) Internet Information Server
( ) Application Object Server
( ) Enterprise Portal
3. Match the following modifications to the layer which they are, or should be,
developed in.
_____ 1. The core customer table
_____ 2. A bank file import format developed by a partner
that can be used for several of their customers.
_____ 3. A new field on the item table required for a vertical
solution developed by an ISV.
_____ 4. A new label code specified on a field to better
reflect a particular customer's terminology.

a.
b.
c.
d.

CUS
VAR
SYS
ISV

4. Which of these statements best describes models in Microsoft Dynamics


AX?
( ) A view of the metadata within the MorphX IDE.
( ) A logical grouping of elements within a layer.
( ) A visual representation of objects.
( ) A piece of X++ code.

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 2012


5. What is displayed in the Application Object Tree? (Select all that apply)
( ) Tables
( ) Forms
( ) Menus
( ) Visual Studio Projects
6. Which tools can developers use to write Microsoft Dynamics AX business
logic? (Select all that apply)
( ) Microsoft Office
( ) Visual Studio
( ) MorphX IDE
( ) SQL Server

1-22

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture

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

1-23

Development I in Microsoft Dynamics AX 2012

Solutions
Test Your Knowledge
1. Microsoft Dynamics AX 2012 has a three-tier architecture. What are the
three tiers and what is the purpose of each tier?
MODEL ANSWER:
SQL Server Database - houses the data entered into, and used by, the
Microsoft Dynamics AX application. It also houses the model store that
contains the application elements. (Application elements are explained in the
following lesson)
Application Object Server - a service that runs most of the business logic.
This runs continuously on a central server.
Client application - the user interface through which an end-user accesses
Microsoft Dynamics AX. There are various clients available including the
Microsoft Dynamics AX rich client and Enterprise Portal.
2. What client applications can be used to access Microsoft Dynamics AX
2012? (Select all that apply)
() Microsoft Dynamics AX Rich Client
( ) Internet Information Server
( ) Application Object Server
() Enterprise Portal
3. Match the following modifications to the layer which they are, or should be,
developed in.
c 1. The core customer table
b 2. A bank file import format developed by a partner that
can be used for several of their customers.
d 3. A new field on the item table required for a vertical
solution developed by an ISV.
a 4. A new label code specified on a field to better reflect
a particular customer's terminology.

a.
b.
c.
d.

CUS
VAR
SYS
ISV

4. Which of these statements best describes models in Microsoft Dynamics


AX?
( ) A view of the metadata within the MorphX IDE.
() A logical grouping of elements within a layer.
( ) A visual representation of objects.
( ) A piece of X++ code.

1-24

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 1: Architecture
5. What is displayed in the Application Object Tree? (Select all that apply)
() Tables
() Forms
() Menus
() Visual Studio Projects
6. Which tools can developers use to write Microsoft Dynamics AX business
logic? (Select all that apply)
( ) Microsoft Office
() Visual Studio
() MorphX IDE
( ) SQL Server

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 2012

1-26

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:

Explain the MorphX development environment and the Application


Object Tree.

Design tables using MorphX.

Describe the different data types within Microsoft Dynamics AX.

Create a new table.

Learn how to create and modify indexes using MorphX.

Describe relations on Microsoft Dynamics AX tables.

Learn how to create and modify Enumerated data types.

Learn how to create and modify views.

Introduction
This chapter introduces the tools and procedures used to create tables, data types,
and relations that are required in Microsoft Dynamics AX.

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 2012

MorphX and the Application Object Tree


The Application Object Tree (AOT) is a tree view of all application elements in
Microsoft Dynamics AX. Each branch node contains a different application
element type. Within the AOT, a developer can create or modify Microsoft
Dynamics AX application elements using drag-and-drop functionality. The
system has default settings for all application object properties.
This chapter focuses on those elements contained in the Data Dictionary node. It
briefly discusses all the elements within the data dictionary. Some of the other
application elements 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.

Procedure: Opening the AOT


Access the AOT from the Microsoft Dynamics AX application. There are four
different ways to open the AOT:

Navigate to Windows > New Development Workspace. A new


development workspace will open with the AOT visible.

FIGURE 2.1 OPENING THE DEVELOPMENT WORKSPACE

2-2

Press Ctrl-Shift-W.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

Press CTRL + D.

Add the -development switch to the ax32.exe command when


starting Microsoft Dynamics AX.

FIGURE 2.2 DEVELOPMENT WORKSPACE AND AOT

Features of the AOT


AOT Toolbar
The toolbar located in the AOT contains five icons, and each icon also has a
short-cut key.
The functions of these icons are as follows:

CTRL + O: Opens the application element directly from the AOT.

ALT + ENTER: Opens the properties sheet for the selected element.

CTRL + SHIFT + S: Saves any changes made to an element.

CTRL+SHIFT+I: Imports an .xpo file containing definitions of


elements.

F7: Compiles the object to locate syntax errors.

NOTE: Microsoft Dynamics AX elements are exported as .xpo files. These are
the only types of files Microsoft Dynamics AX 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 shows all the functions of the right-click menu on the top level of the
AOT, excluding the Data Dictionary.

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 2012


The following figure shows a right-click menu on the Tables node.

FIGURE 2.3 AOT RIGHT-CLICK MENU

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 elements within the MorphX environment.

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


Elements in the Data Dictionary
This section focuses on the application elements located in the Data Dictionary
node of the AOT. The other elements in the AOT are discussed in later sections
in this course. The following list shows all the element types in the Data
Dictionary:

FIGURE 2.4 DATA DICTIONARY ELEMENT TYPES

Tables store data in the system. They contain fields of various 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 are 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 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 are customized data types based on the


primitive MorphX data types including strings, integers, reals, dates,
times, enums, or containers.

Base Enums are a list of literals that 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.

Configuration keys disable features in the application for all users.


Each key controls access to a specific feature, and once it is disabled,
the feature is automatically removed from the user view.

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 2012

License codes control which elements can be enabled. If a license


code is not purchased for a module, then any element attached to that
license code cannot be used.

Security keys are a legacy from previous versions of Microsoft


Dynamics AX and will be removed in the next version. Security is
covered in detail later in this course.

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 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 SQL database created during installation contains
the complete table repository. Tables are at the core of the Microsoft Dynamics
AX application and enable storage of a company's information and transactions.

Understanding Microsoft Dynamics AX Tables


Tables storing data about company transactions, inventory, general ledger,
journals and more, form the base of the Microsoft Dynamics AX application.
These are referred to as base tables or application tables. Some frequently used
tables include:
AX Table
Name

Application Data Detail

CustTable

The table for basic customer information.

VendTable

The table for basic vendor information.

LedgerTable

The table for the general ledger that contains the chart of
accounts information.

InventTable

The table for the general inventory catalog.

PurchTable

The table for purchase order creation information.

Other tables in Microsoft Dynamics AX contain metadata. These tables contain


descriptions of data. Metadata is housed in system tables.

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


System tables are differentiated from application tables by the Sys prefix that
starts the name of the table. The following figure shows examples of system and
application tables.

FIGURE 2.5 SYSTEM TABLES

Microsoft Dynamics AX Table Structure and Components


Tables in Microsoft Dynamics AX contain multiple elements that define the
table. There are seven categories that define tables:

Fields

Field Groups

Indexes

Full Text Indexes

Relations

Delete Actions

Methods

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 2012


The following figure shows these elements:

FIGURE 2.6 TABLE ELEMENTS

Fields
Access the Fields node using MorphX to create or modify the physical columns
in the database table. The fields defined within the Fields node are the columns
belonging to the physical table.
CAUTION: Any fields created, deleted, or modified using MorphX in the Table
node are reflected in the database when the changes are saved. This can
potentially damage the Microsoft Dynamics AX application if not used correctly.

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


Display all the fields for the LogisticsAddressZipCode table by opening the
Fields node. The following figure shows how MorphX is used to view all the
columns within a Microsoft Dynamics AX table.

FIGURE 2.7 FIELDS IN THE ZIP CODE

Field Groups
Field groups in Microsoft Dynamics AX are logical groupings of physical
database fields. Microsoft Dynamics AX uses Field Groups to cluster fields into
logical groups so that these groups can be used on forms and reports. An example
of such a group is the group Measurement located on InventTable. InventTable
holds data relating to products, and the measurement fields are height, width,
depth and density of the products.

FIGURE 2.8 FIELD GROUPS

NOTE: If a modification is made to a field group, application elements that refer


to the field group are automatically updated to reflect the new content of the
group.
IntelliMorph is the term given to the technology that 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.

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 2012


BEST PRACTICES: Define a group when several fields logically belong
together and are shown together on forms. Every field on a table should belong
to a group.

Indexes
The indexes in the Microsoft Dynamics AX table definition are the physical
indexes that exist on the tables in the database. Indexes accelerate a search on a
table's data. More detailed information on indexes is discussed later in this
chapter.

Full-text Indexes
A full-text index contains location information about each significant word in a
string field of a table. Some queries can use this information to run more
efficiently and to complete more quickly. These are queries that search for words
embedded in the middle of string fields.
A full-text index can be created by creating a new full-text index under the fulltext index node on the table, and adding fields to this new full-text index.
Queries can use the full-text index by creating a query range of type Full-Text
Index. If the value in that range has multiple words, the space is treated like a
boolean OR, so any records with at least one of the words in the full text indexed
fields will be returned.
X++ select statements cannot use a full-text index.

Relations
Microsoft Dynamics AX uses a relational database, which means that
relationships can be created between tables that contain related data. In Microsoft
Dynamics AX, the relationship between tables is called a relation.
Relations are discussed in more detail later in this chapter.

Delete Actions
Microsoft Dynamics AX 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:

2-10

None: The row in this table is deleted but nothing occurs in the
specified table.

Cascade: The row in this table is deleted and all related data in the
specified table is also deleted. This ensures that no orphaned records
remain after a deletion.

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 in the specified table. This is used when a parent
record should only be deleted when no child record exists, and the
child record is important to keep, for example, transaction records.

Cascade + Restricted: Behaves the same as Restricted.

NOTE: It is important to create delete actions and to create them correctly to


ensure data integrity.

Methods
Microsoft Dynamics AX uses methods within the table node to perform functions
specific to the table. This can be data lookups to other tables based on data in that
table, or manipulation of the data during specific events. Table methods are
covered in more detail in later development courses.

Inheritance
A table can extend another table, by specifying the Extend property on the table.
This means one table inherits all of the fields, properties and methods of the table
that it extends. New fields and methods can be added to this extending table that
will not be visible from the extended table.

Data Types: Primitive and Extended


Microsoft Dynamics AX uses data types to define how data is stored and
restricted within the database. There are primitive and extended data types
(EDT).

Primitive Data Types


The basic set of primitive data types in Microsoft Dynamics AX 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 used in Microsoft Dynamics AX are as follows:
Primitive

Description

String

A number of characters.

Integer

A number without a decimal point. 32 bits wide.

Real

A number with a decimal point.

Date

Contains day, month and year.

Time

Contains hours, minutes and seconds.

UTCDateTime

A combination of date and time types into one data type that
also holds time zone information.

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 2012


Primitive

Description

Enum

A set of literals that are represented internally as integers.

Container

A composite data type that is a dynamic list of items


containing primitive data types and/or some composite data
types.

GUID

Globally Unique Identifier. A 16-byte number generated that


uniquely identifies a network or interface.

Int64

A number without a decimal point. 64 bits wide.

Boolean

Only contains the values false and true.

Extended Data Types


EDTs extend primitive data types or other EDTs. The benefit of creating EDTs is
the reuse of their properties. For example, the label for one EDT can be inherited
from the EDT that it extends.
A table field that is created based on an EDT will also inherit properties from that
EDT.
Another benefit is more efficient maintenance. The properties of many fields can
change at one time by changing the properties on the EDT.
Most fields in Microsoft Dynamics AX tables are based on EDTs.

Scenario: Veterinary Surgery


The following step procedures and labs will demonstrate how to create a
modification that can be used in a veterinary surgery. The surgery procedure will
need to keep track of each animal that arrives, the owners of the animal, the
species, the breed, and details of each visit including the date, reason and the
cost.
To do this you will need to create the following new tables.

2-12

Species table: This will contain entries such as dog, cat, ferret and so
on.

Breed table: This will contain the breed such as Labrador, Old
English Sheepdog, Bengal, Siamese and so on. This should be
related to the Species Table.

Pet table: This information is related to the customer table and breed
table.

Visit transactions: This will contain the details of each visit for each
pet.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Procedure: Creating a New Extended Data Type
User the following procedure to create a new EDT that will define how the Id of
the species is stored.
1.
2.
3.
4.
5.
6.
7.
8.
9.

Open a new development workspace.


In the AOT, expand the Data Dictionary node.
Right-click the Extended Data Types node.
Select New > String. A new EDT called Type1 is created.
Right-click Type1 and select Properties.
Modify the property Name to VetSpeciesId.
Modify the property Extends to SysGroup.
Modify the property Label to Species Id.
Close the property sheet and click Save in the AOT to save your
changes.
10. On the Database Synchronization dialog, click Yes. This will take a
few minutes to complete.
Setting the Extends property to SysGroup inherits properties from the SysGroup
EDT. This sets the size of the EDT to 10 characters, which is the standard size
for an ID field such as this one.

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 2012


The new EDT and property sheet should appear as follows:

FIGURE 2.9 CREATE VETSPECIESID EDT

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

Lab 2.1 - Create a New EDT


The Veterinary Surgery module also requires a new EDT for the Id of the Breed.
Scenario
The scenario for this lab continues from the preceding scenario.

Challenge Yourself!
Create a new EDT that will be used for the breed Id. Set the label and help as
appropriate. Ensure the size of the field is consistent with the standard
application.

Step by Step
1.
2.
3.
4.
5.
6.
7.
8.
9.

Open a new development workspace.


In the AOT, expand the Data Dictionary node.
Right-click the Extended Data Types node.
Select New > String. A new EDT called Type1 is created.
Right-click Type1 and select Properties.
Modify the property Name to VetBreedId.
Modify the property Extends to SysGroup.
Modify the property Label to Breed Id.
Close the property sheet and click Save in the AOT to save your
changes.
10. On the Database Synchronization dialog, click Yes.

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 2012

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

Procedure: Creating a New Table


Use the following step procedure to create a new table that will store the records
for the species. There are two fields on the table called SpeciesId (type
VetSpeciesId), and Name (type Name).
1. Open a new development workspace.
2. In the AOT, expand the Data Dictionary node.
3. Right-click the Tables node and select New Table. A new Table
called Table1 is created.
4. Right-click Table1 and select Properties.
5. Modify the property Name to VetSpeciesTable.
6. Modify the property Label to Species.
7. Close the property sheet.
8. Press Ctrl-D to open another AOT. Ensure window is not
maximized by clicking the restore down button to enable you to
view both AOT windows.
9. Expand the Data Dictionary node.
10. Expand the Extended Data Types node.
11. Locate the VetSpeciesID EDT.
12. Drag the VetSpeciesID EDT to the Fields node of the
VetSpeciesTable table. A new field called VetSpeciesID is created.
13. Right-click the VetSpeciesId field and click Properties.
14. Note that the Extended Data type for this field is set to VetSpeciesId.
15. In the Name property, set the name of the field to SpeciesId.
16. Close the property sheet.
17. Locate the Name EDT in the second AOT.
18. Drag the Name EDT to the Fields node of the VetSpeciesTable
table. A new field called Name is created.
19. Save your changes to the table. When changes to a table are saved,
Microsoft Dynamics AX automatically synchronizes the changes
made within its Data Dictionary with SQL: this ensures that the
definitions for the tables remain consistent at all times.

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


The new table and property sheet should appear as follows:

FIGURE 2.10 CREATE THE VETSPECIESTABLE TABLE

TIP: To view data in a table use the table browser, by pressing Ctrl-O. This
opens the table in a basic grid form. From here you can view, edit, create and
delete data. This should be used only as a developer tool, and should not be used
to edit live data.

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 2012

Lab 2.2 - Create a New Table


Create a table that will store data for the breed.
Scenario
The scenario for this lab continues from the preceding scenario.

Challenge Yourself!
Create a new table that will store the breed of the pet. The table should have the
fields BreedId (type VetBreedID) and Name (type Name).

Step by Step
1. Open a new development workspace.
2. In the AOT, expand the Data Dictionary node.
3. Right-click on the Tables node and select New Table. A new Table
called Table1 is created.
4. Right-click Table1 and select Properties.
5. Modify the property Name to VetBreedTable.
6. Modify the property Label to Breed.
7. Close the property sheet.
8. Press Ctrl-D to open another AOT. Ensure window is not
maximized by clicking the restore down button to enable you to
view both AOT windows.
9. Expand the Data Dictionary node.
10. Expand the Extended Data Types node.
11. Locate the VetBreedID EDT.
12. Drag the VetBreedID EDT to the Fields node of the VetBreedTable
table. A new field called VetBreedId is created.
13. Right-click the VetBreedId field and click Properties.
14. Note that the Extended Data type for this field is set to VetBreedId.
15. In the Name property, set the name of the field to BreedId.
16. Close the property sheet.
17. Locate the Name EDT in the second AOT.
18. Drag the Name EDT to the Fields node of the VetBreedTable table.
A new field called Name is created.

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

Indexes
Indexes in databases are used to locate records. They are stored separately in the
database, and contain a key that can be quickly located in the index, and a
reference to the record. For example, the CustIdx index of the customer table
contains the account number of the customer. The account number is unique and
sequenced. This is then used to quickly lookup the customer record through the
reference.
There are two types of indexes: unique and non-unique. If a unique index is
created based on a column, Microsoft Dynamics AX ensures no duplicate key
values occur in that column. Also, updates on a column that contain a unique
index, which violates the uniqueness of the column, cause an error.
Non-unique 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 a table. Do not create an index if it is not needed 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. However in most cases the
performance gain when selecting records far outweighs the performance loss
when updating.
When an Index is created, it is recommended to give the Index a name reflecting
the names of the fields in the index, followed by the suffix Idx.

Creating Indexes
Creating an Index in Microsoft Dynamics AX always relates to the table where it
is created. The index can only be created on fields that exist in the table. These
indexes can be unique or non-unique, and are based on 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.

Procedure: Creating an Index


Use the following procedure to create a new index on the SpeciesId field on the
VetSpeciesTable.
1. Locate the VetSpeciesTable table in the AOT.
2. Right-click the Indexes node in the table and select New Index. A
new index Index1 is created.
3. Rename the index to SpeciesIdx.

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 2012


4. Drag the field SpeciesId to the index SpeciesIdx node.
5. In the properties sheet for the SpeciesIdx node, set the property
AllowDuplicates to No.

FIGURE 2.11 CREATING AN INDEX

Primary Index
A primary key is one or more columns that uniquely identify 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. The AccountNum is used in the
AccountIdx index, which is a unique index. This index is then set as the primary
index for the CustTable table in the properties for the table.
To set the primary index on a table, open the property sheet for the table. The
PrimaryIndex property allows any unique index with a key that is mandatory and
cannot be edited.

Procedure: Set a Primary Index


Use the following procedure to set the index created in the previous procedure to
be a primary index.
1. In the AOT, locate the VetSpeciesTable table.
2. In the property sheet for the table, set the PrimaryIndex property on
the table to SpeciesIdx.
3. Close the property sheet for the table.

Surrogate Key
When a primary index is not specified, Microsoft Dynamics AX uses a Surrogate
Key as the primary index. This key is the RecId field and, if the table is saved per
company, the DataAreaId. The surrogate key is used on many relations between
tables.

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

Lab 2.3 - Create a Primary Index


Create primary indexes for the tables you have created previously in this chapter.
Scenario
The scenario for this lab continues from the preceding scenario.

Challenge Yourself!
Set the index created in the last procedure as a primary index for the table. Create
a primary index for the Breed Table.

Step by Step
1. Locate the VetBreedTable table in the AOT.
2. Right-click the Indexes node in the table and select New Index. A
new index Index1 is created.
3. Rename the index to BreedIdx.
4. If you used the property sheet to rename the index, close the property
sheet.
5. Drag the field BreedId to the index BreedIdx node.
6. In the properties sheet for the BreedIdx node, set the property
AllowDuplicates to No.
7. Close the property sheet.
8. In the property sheet for the table, set the PrimaryIndex property on
the table to BreedIdx.
9. Close the property sheet for the table.

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 2012

Relations
Relations between tables are used to associate rows in one table to rows in
another table.
Relations are also used to:

Enforce business rules across tables

Create auto joins in forms (join one table to another table).

Look up values in other tables (using lookups and the View Details
command).

Validate data by providing constraints.

Automatically propagate changes from one table to another by


defining cascading relations.

Generating field help (hover over a field, and data from the related
table is displayed).

Relationships can be created between tables using MorphX.

These relations are defined within the Microsoft Dynamics AX


application and not at the physical database level.

Relations govern the relationships between data in different tables


such as foreign key relationships.

Foreign key relationships between tables are always formed from the
parent table.

Under the relations node you can create different types of relationships between
the parent table and other tables in Microsoft Dynamics AX.

2-22

Normal specifies related fields in another table. Multiple fields can


be included in this relation. For example, table
LogisticsPostalAddress has a relation called State that defines the
relation to the LogisticsAddressState table. The values allowed in the
state field are limited depending on which country is entered.

Field fixed specifies related fields that restrict the records in the
primary table. The fixed field is normally an enum.

Related field fixed specifies related fields that restrict the records in
the related table. The related fixed field is normally an enum.

ForeignKey specifies a correspondence between a foreign key field


in the present table to the primary key field in another parent table. A
ForeignKey can be a PrimaryKey or a Single Field Altenate Key.
When it is a Primary Key, the relation is on the primary key field, for
example customer account. When it is a Single Field Alternate Key,
the relation is on the surrogate key, which is usually the RecId.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary


Procedure: Creating a Relation
Use this step procedure to create a relation between the breed and the species
table. The breed is related to the species table - a breed of Old English Sheepdog,
is related to the record Dog in the Species table. You should not be able to have a
cat that has a breed of Old English Sheepdog.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

13.

In the AOT, locate the VetSpeciesId EDT.


Right-click the VetSpeciesId EDT and select Properties.
In the ReferenceTable property enter VetSpeciesTable.
Close the properties sheet.
Expand the VetSpeciesId node.
Right-click the Table References node and select New > Table.
Reference. A new table reference is created.
Right-click the VetSpeciesId Table Reference and select properties.
In the related field property, enter SpeciesId.
Close the property sheet and save your changes to the EDT.
If the database synchronization dialog appears, click Yes.
Drag the VetSpeciesID EDT to the field node on the
VetBreedTable table.
When prompted to add the ForeignKey relation from the EDT, click
Yes. This will automatically create the relation between the
VetBreedTable table and the VetSpeciesTable.
Rename the VetSpeciesId field to SpeciesId.

FIGURE 2.12 CREATING A RELATION

Relations can also be added manually by right-clicking the relations node on the
table. However when you create the reference on the EDT and set it as a primary
key, once the EDT is added to a table, the system will prompt to add the
reference automatically.

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 2012

Lab 2.4 - Create a Relation


Create another new table that will link customers to pets they own.
Scenario
The scenario for this lab continues from the preceding scenario.

Challenge Yourself!
Create a new table that will store data about the pets belonging to each customer.
The table will need to have the following fields: Customer Account (Type
CustAccount), PetName (Name), Species (VetSpeciesId), Breed (VetBreedId).
You should create two relations - one a foreign key to the species table, and one a
normal relation to the breed table so that it is limited based on the species field
entered.

Step by Step
1. Open a new development workspace.
2. In the AOT, expand the Data Dictionary node.
3. Right-click the Tables node and select New Table. A new Table
called Table1 is created.
4. Right-click Table1 and select Properties.
5. Modify the property Name to VetCustPetTable.
6. Modify the property Label to Pets.
7. Close the property sheet.
8. Press Ctrl-D to open another AOT.
9. Expand the Data Dictionary node.
10. Expand the Extended Data Types node.
11. Locate the CustAccount EDT.
12. Drag the CustAccount EDT to the Fields node of the
VetCustPetTable table.
13. Locate the VetSpeciesId EDT.
14. Drag the VetSpeciesId EDT to the Fields node of the
VetCustPetTable table. A new field called VetSpeciesId is created.
15. Click Yes to create the foreign key
16. Right-click the VetSpeciesId field and click Properties.
17. In the Name property, set the name of the field to SpeciesId.
18. Close the property sheet.
19. Locate the VetBreedID EDT.
20. Drag the VetBreedID EDT to the Fields node of the
VetCustPetTable table. A new field called VetBreedId is created.
21. Right-click the VetBreedId field and click Properties.
22. In the Name property, set the name of the field to BreedId.

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


23. Close the property sheet.
24. Locate the Name EDT in the second AOT.
25. Drag the Name EDT to the Fields node of the VetBreedTable table.
A new field called Name is created.
26. Right-click the Relations node on the VetCustPetTable node and
select New Relation.
27. In the properties sheet for the new relation, set the Name property to
VetBreedTable and the Table property to VetBreedTable.
28. Right-click the VetBreedTable relation, select New > Normal.
29. In the property sheet for the new normal relation, set the Field to
BreedId and the RelatedField to BreedID.
30. Right-click the VetBreedTable relation, select New > Normal.
31. In the property sheet for the new normal relation, set the Field to
SpeciesId and the RelatedField to SpeciesId.
32. Save your changes.

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 2012

Base Enumerations
Base enumerations, also called Base Enums, are pre-defined text values for a
field that are referenced through an integer value in the database.

FIGURE 2.13 GENDER BASE ENUM

The figure shows the Gender Base Enum, with the value of Male corresponding
to the integer value of 1.

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

Lab 2.5 - Add an Enum


The pet table needs to store whether the animal is male or female.
Scenario
The scenario for this lab continues from the preceding scenario.

Challenge Yourself!
Add the Gender Enum to the VetCustPetTable table.

Step by Step
1. Locate the Gender enum in the Base Enums node in the AOT.
2. Drag the Gender enum to the Fields node in the VetCustPetTable
table.
3. Save your changes to the 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 2012

Views
A Microsoft Dynamics AX 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.
In Microsoft Dynamics AX, 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

Description

Focused
Data

A view is used to retrieve and return only the data that is relevant
for a particular user or scenario.

Customize
d Data

A view enables the use of a complex query to create a highlycustomized set of data. For example, a view often represents data
as a single table that is retrieved from multiple joined tables and
uses many conditions.

Performan
ce

A view can improve performance by returning only relevant


fields to the user. In addition, a view definition is compiled
which can provide better performance than calling an
equivalently complex query.

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.

Summary
This course discussed the Microsoft Dynamics AX Data Dictionary and the
related objects in the Application Object Tree.
This course 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.

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

Test Your Knowledge


Test your knowledge with the following questions.
1. Put the following steps in order to create a new Primary Index in a table.
Step:
_____: Set the Primary Index on the Table to the Unique Index
_____: Set the name for the new index
_____: Create a new index
_____: Synchronize the AOT
_____: Set the Allow Duplicates property on the index to No
_____: Add the primary key field(s) to the index
2. Which of the following are allowable data types for an index?
( ) String, Integer, Real, and Container
( ) String, Enumerated, Real, and Memo
( ) String, Integer, Real, and Enumerated
( ) Memo, Container, Map, and integer
3. Which of the following nodes are required to define a table? (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-29

Development I in Microsoft Dynamics AX 2012

Quick Interaction: Lessons Learned


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

2.

3.

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

Solutions
Test Your Knowledge
1. Put the following steps in order to create a new Primary Index in a table.
Step:
6

: Set the Primary Index on the Table to the Unique Index

: Set the name for the new index

: Create a new index

: Synchronize the AOT

: Set the Allow Duplicates property on the index to No

: Add the primary key field(s) to the index

2. Which of the following are allowable data types for an index?


( ) String, Integer, Real, and Container
( ) String, Enumerated, Real, and Memo
() String, Integer, Real, and Enumerated
( ) Memo, Container, Map, and integer
3. Which of the following nodes are required to define a table? (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-31

Development I in Microsoft Dynamics AX 2012

2-32

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:

Design and build Forms in Microsoft Dynamics AX.

Join two data sources on a form.

Create customized menus and menu items.

Create a form using form templates.

Know the components of a list page.

Create a new FactBox.

Introduction
This course discusses how to develop the user interface without having to write
any code.
Forms are created so that the end-user can enter and view data. To make
navigation easier for the end-user, menus and menu items will be created.

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 2012

Forms
Forms are the primary method of interaction between Microsoft Dynamics AX
and the end-user. By understanding and exploring existing forms, new forms can
be developed while retaining the same look and feel as standard Microsoft
Dynamics AX forms.

Elements that Compose a Form


Forms are composed of multiple object categories. The basic object categories of
a form include:

Methods

Data Sources

Parts

Designs

Permissions

To examine these categories, open the Application Object Tree (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.1 CUSTTABLE FORM NODE

Form methods are blocks of X++ code that, for example, are executed when
opening or closing the Form. Form methods are discussed in a later development
course. This course discusses Data sources, Designs and Parts. The next chapter
will discuss Permissions.

Form Designs
Several different standard form designs are available for use in different
situations. To better understand Forms and their design, this course will examine
some of the forms in the application.

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


Demonstration: Examining Form Design
This demonstration explains the design of a pre-existing form.
From the application workspace main menu, navigate to Accounts Receivable >
Customers > All customers.

FIGURE 3.2 CUSTOMER LIST FORM

The main part of the form is the grid that displays a list of customers.
Immediately above the grid is a filter. At the top is the Action Pane containing
buttons that will take you to another form, or process an action. On the right is
the FactBox pane that displays information from other tables linked to the
customer record that are currently highlighted. At the bottom is the Preview
Pane, showing more information from the customer table.
Now in the developer workspace, locate the form CustTableListPage. Expand the
Parts node, and the Designs > Design node.

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 2012


HINT: You can right click the form and select Personalize. Select the
Information tab, it will show a Form name: CustTableListPage. Select the Edit
button and this will open an instance of this object in the AOT.

FIGURE 3.3 DESIGN OF THE CUSTTABLELISTPAGE FORM

In the Design node, the Action Pane, the Filter, and the Grid are visible. The
Parts node includes links to the parts displayed on the form. The first part is the
CustListPagePreviewPane, and the other parts are the FactBox parts. If you
expand the Grid node, the fields on the grid are visible.

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


Now return to the application workspace. Click the Edit button in the Action
Pane. This opens a new form with more details about the customer and you can
edit the record.

FIGURE 3.4 THE CUSTTABLE FORM DESIGN

The form also includes an Action Pane and a FactBox Pane. The main part of the
form has FastTabs. You can click on each FastTab to obtain more information
about the customer. At the bottom of the form in the status bar, there are a
number of navigation buttons. If you click the Grid View button, the form
displays records in grid form, and you can select another customer record. You
can click on Details View to show the details again.

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 2012


Now return to the development workspace and locate the form CustTable in the
AOT. This is the form that displays the customer details. Expand nodes
Designs > Design > Tab > TabPageDetails > TabHeader and Designs >
Design > Tab > TabPageGrid > GridGroup > Grid.

FIGURE 3.5 DESIGN OF THE CUSTTABLE FORM

The TabHeader shows the tabs that comprise the FastTabs on the Details View.
Under the TabPageGrid node is the grid that makes up the Grid View.

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


Now return to the Customer details form in the application workspace. In the
Action Pane click Sell > Sales Price > Sales Price. The Sales Price Agreements
form opens.

FIGURE 3.6 SALES PRICE AGREEMENT FORM

Here is a more simple form with a grid section and some additional fields at the
bottom.

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 2012


In the development workspace, find the form PriceDiscTable. This is the form
that displays price agreements. Expand Designs > Design > PriceDiscGroup >
DiscAgreement > Grid. The fields displayed in the grid are visible.

FIGURE 3.7 PRICEDISCTABLE DESIGN

Form 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 they link to the Tables in the
AOT.

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


Expand the Data Sources node for the PriceDiscTable form and view the
properties for the PriceDiscTable data source.

FIGURE 3.8 DATA SOURCES FOR PRICEDISCTABLE FORM

The Property sheet lists properties for the PriceDiscTable data source on the
PriceDiscTable form. For example, the AllowCreate and AllowDelete
properties control whether you can create new rows or delete old rows from the
price agreement form. The Table property specifies the table the data source is
based on (in this case, the PriceDiscTable). The Index Property controls the
index that 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. Joining data sources on
a form is examined later in this chapter. Viewing the properties for the
InventDim data source on this form, shows that it is joined to the
PriceDiscTable. The system uses relations between the tables to join records
together.
Expanding the PriceDiscTable data source shows a Fields node. Under this list
all the fields on the table. Properties can be set here to control the behavior of the
field when it is used as a control on the form, including allowing the field to be
edited and whether it is visible or not.

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 2012


Procedure: Creating a Form
Us the following step procedure to create a form that will be used to view, create
and edit records in the VetSpeciesTable.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

In the AOT, right-click the Forms node and select New Form.
Rename the form to VetSpeciesTable.
In a second AOT, locate the table VetSpeciesTable.
Drag the table VetSpeciesTable to the DataSources node on the
VetSpeciesTable form.
Expand the Designs node on the VetSpeciesTable form.
Right-click the Designs node and select New Control > Grid. A
new Grid control is created.
Expand the DataSources > VetSpeciesTable > Fields node.
Drag the fields SpeciesId and Name to the grid control.
On the properties sheet for the Design node, in the Caption property,
enter "Species".
Save your changes to the form.
Open the form by pressing Ctrl+O.
Populate the table by entering your own data in to the form.

FIGURE 3.9 SPECIES FORM

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

Lab 3.1 - Create a Form


Create a new form to display and edit breed records
Scenario
The scenario is continued from the previous lesson.

Challenge Yourself!
Create a new form that can be used to view, create and edit records in the
VetBreedTable table.

Step by Step
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.

In the AOT, right-click the Forms node and select New Form
Rename the form to VetBreedTable.
In a second AOT, locate the table VetBreedTable.
Drag the table VetBreedTable to the DataSources node on the
VetBreedTable form.
Expand the Designs node on the VetBreedTable form.
Right-click the Design node and select New Control > Grid. A new
Grid control is created.
Expand the DataSources > VetBreedTable > Fields node.
Drag the fields BreedId and Name to the grid control.
On the properties sheet for the Design node, in the Caption property,
enter "Breed".
Save your changes to the form.
Open the form by pressing Ctrl+O.

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 2012

Joining Data Sources


Instead of creating two forms for the species and breed tables, both tables could
be placed on the same form, and joined together to make viewing and creating
records simpler.

Procedure: Add a Second Data Source to a Form


Use this step procedure to add the VetBreedTable to the VetSpeciesTable form,
join it to the VetSpeciesTable datasource, and display it in a second grid.
1. Locate the VetSpeciesTable form in the AOT.
2. From a second AOT, drag the VetBreedTable table to the Data
Sources node of the VetSpeciesTable form.
3. In the property sheet for the VetBreedTable data source, set the
property JoinSource to VetSpeciesTable. The system will
automatically use the relations created in the previous chapter to link
the correct records together.
4. Right-click the Designs > Design node and select New Control >
Grid. A new grid control Grid1 will be created.
5. In property sheet for Grid1, set the property DataSource to
VetBreedTable. This step is needed because when a new grid
control is created, the system sets the datasource as the first
datasource on the form by default.
6. Drag the fields BreedId and Name from the VetBreedTable
datasource to the Grid1 grid control.
7. To make the two grids appear side by side, in the property sheet of
the Design node, set the Columns property to 2.

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


8. Save your changes to the form and open it using Ctrl+O.
9. Add your own data to the table by creating new records in the form.
Note how the breed records are linked to the species record and filter
on the breed field. This is due to the relations defined in the previous
lesson.

FIGURE 3.10 SPECIES AND BREEDS JOINED

Menus Items
You can use menu items to activate application objects from the user interface.
Menu properties include the following:

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

Three types of menu items can be created:

Display - used for forms

Output - used for reports

Action - used for running processes

Output and Action menu items are discussed in other training courses.

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 2012


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 CustTableListPage form. This Display Menu item points to
the Form object CustTableListPage.

FIGURE 3.11 MENU ITEMS

There are two important Properties to notice.

Object type = Form

Object = CustTableListPage

Procedure: Creating a Menu Item


Use this step procedure to create a menu item to open the VetSpeciesTable form.
1. Open the AOT, expand the Menu Items node.
2. Open a second AOT and locate the VetSpeciesTable form.
3. Drag the VetSpeciesTable form to the Display node of the Menu
Items node. A new display menu item is created.
4. In the properties sheet of the new menu item, set the label property to
"Species".
5. Save your changes.

Procedure: Adding a Menu Item to the Area Page


Use this step procedure to add the menu item created in the previous procedure to
the area page. The main menu is comprised of a number of area pages. You will
add your menu item to the AccountsReceivable area page.
1. Open the AOT, expand the Menus node.
2. Expand the AccountsReceivable menu.
3. Right-click the Setup sub-menu, and select New > Submenu. A new
submenu Submenu1 is created.
4. In the properties sheet for the new submenu set the name property to
VetSurgery, and the label property to Vet Surgery.
5. In a second AOT, locate the VetSpeciesTable menu item created in
the previous procedure.
6. Drag the VetSpeciesTable menu item to the VetSurgery submenu.
7. Save your changes to the AccountsReceivable menu.
8. Open a new application workspace. The new submenu and the menu
item are visible in the Accounts Receivable menu.

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

Form Templates
Some form templates are available to help create the correct form type with the
appropriate controls, and to keep the design consistent across the application. The
following table shows the available form templates and where they should be
used.
Form Template

Use

ListPage

Main entry in to a module.

DetailsFormMaster

View and edit master data.

DetailsFormTransaction

View and edit transactional and worksheet data.

SimpleListDetails

Reference and setup data.

SimpleList

Basic inquiry.

TableOfContents

Module configuration parameters.

Dialog

Quick user interaction.

Examples of Templates
The following table gives examples of each form template
Form Template

Menu path

ListPage

Accounts receivable > Common > Customers > All


Customers

DetailsFormMaster

Accounts receivable > Common > Customers > All


Customers > Edit

DetailsFormTransa
ction

Sales and marketing > Common > Sales Orders > All
sales orders > Edit

SimpleListDetails

General ledger > Setup > Currency > Currencies

SimpleList

Master planning > Inquiries > Processes > Planned


orders log

TableOfContents

Accounts payable > Setup > Accounts payable


parameters

Dialog

Product information management > Products >


Products > New product

To create a form using a template, right-click the Forms node in the AOT, select
New Form From Template, and then select the template. Try to create each
template and examine the controls and design that is created. Then open the
corresponding form in the application, as shown above, and look at the finished
product.

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 2012

Lab 3.2 - Create a Form from a Template


A form is needed to view which pets belong to which customers. The form will
be called from the customer form.
Scenario
The scenario for this lab continues from the preceding scenario

Challenge Yourself!
Create a form using a SimpleListDetails template. In the grid on the left it should
show the Pet Name and Gender from the VetCustPetTable table. In the details
section on the right of the form, it should show the Breed name. Additionally,
create a menu item for the form, however do not add the menu item to a menu you will use the menu item in the next section.

Step by Step
1. Right click the Forms node of the AOT and select New Form from
Template > SimpleListDetails.
2. Rename the form VetCustPetTable.
3. Drag the table VetCustPetTable from a second AOT to the
datasources node of the new form.
4. Set the data source property on the grid control on the form to
VetCustPetTable. The grid control can be found by expanding
Designs > Design > Group:Body > Group:GridContainer.
5. Drag the BreedId, Name and Gender fields to the grid of the
designs node.
6. Save your changes to the form.
7. Drag the VetCustPetTable form to the Menu Items > Display node
in a second AOT to create a menu item for the new form.
8. In the property sheet for the new menu item, set the Label property
to Pets.
9. Close the property sheet and save your changes to the menu item.

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

List Pages
List pages are the primary method of displaying data in Microsoft Dynamics AX.
They can show lots of data from many tables, in a number of formats. They have
consistent designs and functions. They can easily be displayed in the enterprise
portal.

List Page Format


The following image shows the different parts of a list page.

FIGURE 3.12 LIST PAGE DESIGN

The components of a list page are:

The Grid displays a list of records. It displays only a few of the most
important fields for each record.

The Filter bar is used to enter search criteria. This filters the list in
the data grid to show only the records which an end-user is interested
in.

The Preview Pane displays more fields about the selected record.
This helps to ensure you have selected the correct record in your
search.

FactBoxes display more information about the selected record from


related tables.

The Action Pane contains menu items you can use to do typical
tasks related to the highlighted record.

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 2012


Procedure: Adding a Menu Item to a List Page
Use this step procedure to add a menu item to an existing list page. You will add
the menu item created in the previous lab to the CustTableListPage form.
1. In the AOT, find the CustTableListPage form.
2. Expand the Designs > Design node.
3. Right-click the Action Pane node, select New control >
ActionPaneTab. A new Action Pane tab is created.
4. Rename the new Action Pane tab apTabVet.
5. In the property sheet for apTabVet set the caption to Vet Surgery.
6. Expand apTabVet.
7. In a second AOT, locate the VetCustPetTable menu item created in
the previous lab.
8. Drag the VetCustPetTable menu item to the ButtonGroup node in
the apTabVet Action Pane tab.
9. Open the properties sheet for the VetCustPetTable button just
created.
10. Set the DataSource property to CustTable.
11. Set the Big property to Yes.
12. In the NormalImage property click on the button to select a file.
This image will show on the button. There are many bitmaps
included in windows, so for the purposes of this lab, find and select
one.
13. Save your changes to the CustTableListPage form.

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


14. In the application workspace, open Accounts Receivable >
Common > Customers > All Customers. Note the new Vet Surgery
tab in the Action Pane.
15. Click Vet Surgery > Pets. Note that the form is opened and only
pets attached to the current customer are displayed. This is due to the
relation between the CustTable and VetCustPetTable tables, and
setting the datasource on the button to CustTable.

FIGURE 3.13 ADDING A BUTTON TO A LIST PAGE

FactBoxes
A FactBox is a small selection of data related to the current record in the list
page. Three types of Factbox exist:

Info part: This has its own data source and a number of controls. It
is limited in what can be displayed. However it is simple and quick
to create, and can also be displayed in the Enterprise Portal.

Form part: This is a link to a form. The form can have the same
controls as a standard form. However since this is displayed in the
FactBox section of the list page, adding too many controls can crowd
the part.

Cues: This is a count of a number of records related to the current


record in the list page. For example, it might show the number of
outstanding invoices for a customer.

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 2012


Procedure: Create a FactBox
Use the following step procedure to create a simple FactBox to display the
customer's pets. A FactBox uses a Query, which is similar to a View. It is used to
select data from one or more tables.
1. In the AOT, right-click the Queries node and select New Query.
Rename the new query to VetCustPetInfoPart.
2. In a second AOT, locate the VetCustPetTable table.
3. Drag the VetCustPetTable table to the DataSources node on the
VetCustPetInfoPart query.
4. Expand the VetCustPetTable_1 data source.
5. In the property sheet for the fields node set the Dynamic property to
Yes. This means all fields in the table will be included in the query.
6. In a second AOT, locate the VetBreedTable table.
7. Drag the VetBreedTable to the DataSources node on the
VetCustPetTable_1 datasource.
8. In the property sheet for the VetBreedTable_1 datasource, set the
Relations property to Yes.
9. In the property sheet for the fields node on the VetBreedTable_1
datasource, set the Dynamic property to Yes.
10. Save your changes to the VetCustPetInfoPart query.
11. Expand the Parts node in the AOT.
12. Right-click the Info Parts node and select New Info Part.
13. In the property sheet for the new info part, set the Name property to
VetCustPetTableInfoPart, set the Caption property to Pets, set the
Query property to VetCustPetInfoPart.
14. Right-click the Layout node in the info part, and select New Group.
15. In the property sheet for the group, set the Repeating property to
Yes.
16. Right-click the new group and select New Field.
17. In the property sheet for the new field, set the DataSource property
to VetCustPetTable_1, and the DataField property to Name.
18. Right-click the group and select New Field to create a second field.
19. In the property sheet for the second field, set the DataSource.
property to VetBreedTable_1 and the DataField property to Name
20. Save your changes to the VetCustPetTableInfoPart info part.

Procedure: Adding a FactBox to a List Page


Use the following step procedure to add the FactBox to the customer's list page.
1. Create a new menu item for the info part, by dragging the
VetCustPetTableInfoPart to the Menu Items > Display node in
the AOT.
2. Locate the VetCustPetTable table in the AOT.

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


3.
4.
5.
6.
7.
8.
9.
10.

11.
12.

Expand VetCustPetTable table.


Right-click the Indexes node and select New Index
Rename the index to CustIdx
From the fields node on the table, drag the CustAccount field to the
CustIdx index.
Save your changes to the table.
Locate the CustTableListPage form in the AOT.
Drag the VetCustPetTableInfoPart menu item to the Parts node.
In the property sheet for the new part reference, set the
DataSourceRelation property to
EDT.VetCustPetTable.CustAccount.
Save your changes to the CustTableListPage form.
Open the customer's list page and notice the new info part in the
FactBox section of the form.

FIGURE 3.14 PETS FACTBOX

Summary
This course discussed how to develop the user interface using the drag and drop
features of the Application Object Tree. Additionally, this course showed some
of the different features of a form, how to create a form, how to have multiple
linked tables on a form, and how to create menu items and add them to menus
and other forms. The course also showed how to modify a list page and create a
FactBox for a list page.

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 2012

Test Your Knowledge


Test your knowledge with the following questions.
1. What are the five elements that make up a form?
( ) Methods, Data Sources, Views, Parts and Fields
( ) Designs, Methods, Data Sources, Parts and Permissions
( ) Display Menu Items, Data Sources, Methods, Enums and Designs
( ) Jobs, Menu Items, Classes, Parts and Macros
2. How can the Area Pages 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. Which of the following are available Form Templates? (Select all that apply)
( ) ListPage
( ) TransactionPage
( ) WebPage
( ) SimpleListDetails
4. Which of the following are available Menu Items? (Select all that apply)
( ) Display Menu Items
( ) Output Menu Items
( ) Project Menu Items
( ) Action Menu Items

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

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

3-23

Development I in Microsoft Dynamics AX 2012

Solutions
Test Your Knowledge
1. What are the five elements that make up a form?
( ) Methods, Data Sources, Views, Parts and Fields
() Designs, Methods, Data Sources, Parts and Permissions
( ) Display Menu Items, Data Sources, Methods, Enums and Designs
( ) Jobs, Menu Items, Classes, Parts and Macros
2. How can the Area Pages 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. Which of the following are available Form Templates? (Select all that apply)
() ListPage
( ) TransactionPage
( ) WebPage
() SimpleListDetails
4. Which of the following are available Menu Items? (Select all that apply)
() Display Menu Items
() Output Menu Items
( ) Project Menu Items
() Action Menu Items

3-24

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 4: Security

CHAPTER 4: SECURITY
Objectives
The objectives are:

Describe the elements of Role Based Security in Microsoft


Dynamics AX.

Setup a new user.

Assign roles to a user.

Assign a security role to a user.

Edit duties assigned to a role.

Edit privileges assigned to a duty.

Edit permissions assigned to a privilege.

Search for roles with access to a menu item.

Introduction
Role based security provides an extensible framework for defining access to the
Microsoft Dynamics AX application and data.
A security role relates to a job role that an end-user has within an organization.
The role includes duties, privileges and permissions required to perform the tasks
required in that role.
The maintenance of roles and duties is typically undertaken by the system
administrator in the rich client.
The maintenance of privileges and permissions is typically undertaken by a
developer in the developer workspace.
The framework and related tools assist the security administrator to ensure the
system is secure.

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 2012

Definitions
Role based security is designed with the following base concepts.
An end-user is given one or more security roles. A security role represents a
behavior pattern that a person in the organization can play. An example is the
Accounts receivable manager. A security role includes one or more duties.
A duty is a responsibility to perform one or more tasks. Examples of the
Accounts receivable manager's duties are to maintain the customer master and
inquire into the chart of accounts. A duty includes one or more privileges
Privileges specify the access that is required to perform a duty. For example, the
duty of maintaining the customer master requires privileges to maintain
customers and maintain customer bank accounts. A privilege includes one or
more permissions.
Permissions include the access level to one or more securable objects that are
required to perform the function associated with an entry point. For example, the
privilege of maintaining customers requires permissions that give full control to
the customer form accessed through the entry point of a display menu item. It
also requires full control to create a new address accessed through the entry point
of an action menu item.

FIGURE 4.1 SECURITY EXAMPLE

4-2

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 4: Security
Entry Points
An entry point is the element that is triggered by a user action to start a particular
function. There are three different categories of entry points in Microsoft
Dynamics AX:

Menu items point to forms, reports and classes that an end-user can
access from the rich client.

Web content items point to URLs and actions that an end-user can
access from the Enterprise Portal.

Service operations are used in document service classes in the


Application Integration Framework (AIF). AIF exchanges data with
external systems by sending and receiving XML documents.

Permissions
Permissions refer to the access levels that can be applied to the securable
objects. This could include any tables, fields, forms, reports or server side
methods that are accessible through an entry point.
Permissions are maintained by a developer in the Application Object Tree
(AOT).
Access levels available are:
AOT
name

Label

Description

No Access

No
Access

Does not provide any access to data.

Read

View

An end-user can view data.

Update

Edit

An end-user can view and edit data.

Create

Create

An end-user can view, edit and create new data.

Correct

Correcti
on

An end-user can view, edit, create new and correct


date-effective records without creating new records.

Delete

Full
control

An end-user can view, edit, create new and delete


data.

Permissions that give access to reports or classes need only to have access or not
have access. By convention, reports are typically given read access and classes
are typically given delete access.
Permissions that give access to tables or fields can make use of all access levels.
Possible permission levels are defined on the entry point target. For example, a
form might allow permission levels to read, update, create or delete. The level to
be granted to an end-user is defined on the permission.

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 2012


Privileges
A Privilege is a group of related permissions that are required to perform a duty.
Privileges can be assigned directly to roles. However, for easier administrative
maintenance and to use the Segregation of Duties feature, it is recommended to
group privileges into duties and assign duties to roles.
Privileges are typically maintained by a developer in the AOT however they can
also be maintained by a system administrator in the rich client.
A best practice is for privileges to be maintained in the AOT and to assign
privileges to duties.

Duties
Duties are a group of related privileges required to perform a task.
Duties are grouped into the following six Process Cycles.

Conversion cycle

Cost accounting cycle

Expenditure cycle

Human capital management cycle

Information technology cycle

Revenue cycle

Process cycles are used in the rich client to make it easier for a system
administrator to view and find related duties when setting up security.

Roles
Roles are a group of duties that are required by an end-user to do his or her job
based on the end-user's role in the organization.
Roles can be organized into a role hierarchy. Roles can contain sub-roles and
inherit the permissions from the sub-role. For example, the accounting manager
role could be defined as a combination of the manager role and the accountant
role. A role hierarchy reduces the need for duplicating security access that makes
access change management simpler.

4-4

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 4: Security

Set Up a New User


Users are setup in the rich client. They are typically imported from Active
Directory.
A user is assigned multiple roles. An internal user is assigned the following two
roles in addition to functional roles:

The System user role provides access to basic functionality and


tools so that a user can access and use base functions in Microsoft
Dynamics AX.

The Employee role provides access to base functionality that all


internal roles can use. This includes employee self-service on the
Enterprise Portal.

Procedure: Import User from Active Directory


Scenario: Tony Krijnen has just started with Contoso in the Accounts Receivable
Department. Chris, the Information Technology (IT) engineer, is responsible for
setting up new users and assigning security. Chris has already set up Tony as a
user in Active Directory and now he needs to give him access to Microsoft
Dynamics AX.
1. Open the Microsoft Dynamics AX client.
2. Open the Users form. System Administration > Common >
Users > Users.
3. Click New > Import in the Action Pane.
4. Click Next.
5. Select the domain name contoso.com.
6. Enter Tony for the first name.
7. Click Next.
8. Click Select all.
9. Click Next.
10. Click Next.
11. Select only System User and Employee roles. Chris is not yet sure
what level of access Tony needs.
12. Click Next.
13. Select Accounts receivable administrator profile in Same profile
in all companies. This defines Tony's role center.
14. Click Next.
15. Click Finish.

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 2012


Procedure: Give user access to SharePoint
Tony will also need access to SharePoint in order to view his roll center page.
The following procedure will give Tony access to the SharePoint Enterprise
Portal site.
1.
2.
3.
4.
5.
6.
7.

Open Internet Explorer


Click Site Actions > Site Permissions
Click Grant Permissions
In the Users\Groups box, enter Tony
Click Check Names
Check Full Control
Click OK

Assign a User to a Role


Roles are typically maintained by the system administrator in the rich client
however they can also be maintained by a developer in the AOT.
The Security roles form available in the rich client displays all roles defined in
the application and the duties associated with each role.
This form can be accessed from System Administration > Setup > Security >
Security roles.
New roles can be created from the security roles page.
Roles and associated duties can also be viewed in the security node in the AOT.

Security Roles Form


The security roles form displays the following information:

All existing Roles are listed in the left pane of the form.

The AOT name for the selected role is displayed at the top center of
the form together with the name and description. The AOT name is
the object name displayed in the AOT.

The Role content pane in the bottom center of the form displays the
duties that are associated with the selected role.

The FactBox pane contains three FactBoxes that contain related


information.
o
o
o

4-6

Roles with selected duty display other roles that contain the
duty currently selected in the Role content pane.
Privileges in selected role displays a list of privileges associated
with the selected role.
Users with selected role displays a list of all users assigned the
selected role.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 4: Security

The Action Pane includes various actions including creating or


deleting roles, assigning users to a role and overriding permissions
currently granted to a role.

FIGURE 4.2 SECURITY ROLES FORM

Procedure: Add Roles to an Existing User


Scenario: Chris is advised that Tony Krijnen is the new Accounts receivable
manager. He needs to assign that role to Tony's user account.
1.
2.
3.
4.
5.
6.

Open the Microsoft Dynamics AX client.


Go to System Administration > Common > Users > Users.
Double-click Tony Krijnen in the grid to edit his record.
Click Assign roles in the User's role section of the form.
Select Accounts receivable manager and click OK.
Click Start > Power button options > Switch User.

FIGURE 4.3 SWITCH USER

7. Press Ctrl-Alt-Delete to log on.


8. Click Other User.

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 2012


9.
10.
11.
12.

Log on as Tony, password Pa$$w0rd.


Run the Dynamics AX client.
View the changes in Tony's access.
Switch user back to Administrator

Security Roles in the AOT


You can also view and edit roles in the Security > Roles node in the AOT. You
can right-click the Roles node to add a new role, and drag-and-drop duties from
the Security > Duties node to add duties to a role.
NOTE: You might need to refresh elements in the AOT so that the changes made
in the rich client are visible. In the developer workspace, navigate to
Tools menu > Caches > Refresh Elements.

Change Duties on a Role


The system administrator maintains the assignment of duties to roles in the rich
client; however this can also be maintained by a developer in the AOT.
Duties can be added or removed from a role in the Security roles form available
in the rich client.
This form can be accessed from System Administration > Setup > Security >
Security roles.
Duties assigned to a role can also be edited in the security node of the AOT.

Procedure: Add Duties to an Existing Role


Scenario: Tony Krijnen will be working closely with service related customers so
he needs access to view service orders which is not included in the standard
Accounts receivable manager role. Chris is asked to add service order access to
the Accounts receivable manager role.
1. Open the Rich client.
2. Go to System Administration > Setup > Security > Security roles.
3. Click Accounts receivable manager in the list of roles on the left
side of the form.
4. Click the Add button in the Role content section in the center of the
form to add a new duty.
5. Expand the Conversion cycle process cycle.
6. Select the Inquire into service orders privilege.
7. Click Close.
8. Click Start > Power button options > Switch User.
9. Press Ctrl-Alt-Delete to log on.
10. Click Other User.

4-8

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 4: Security
11.
12.
13.
14.

Log on as Tony, password Pa$$w0rd.


Run the Dynamics AX client.
View the changes in Tony's access.
Switch user back to Administrator.

Adding Duties to a Role in the AOT


Duties can also be assigned to a role in the Security > Roles node in the AOT.
You can also drag-and-drop duties from the Security > Duties node to a role.
NOTE: You might need to refresh elements in the AOT so the changes made in
the rich client are visible. In the developer workspace, navigate to Tools menu >
Caches > Refresh Elements.

Change Privileges on a Duty


The assignment of privileges to duties is maintained by a developer in the
security node of the AOT.
The Security privileges form available in the rich client displays all duties
defined in the application and the privileges associated with each duty. Duties are
grouped by process cycle. Privileges cannot be added to a duty from here.
This form can be accessed from System Administration > Setup > Security >
Security privileges.

Procedure: Add a Privilege to a Duty


Scenario: Chris, the IT Manager, is asked to add access to the Service order
margin report for everyone with access to view service orders. Chris realizes the
best way to do this is to add a privilege with permission to access the report to
the Inquire on service order duty.
1. Open the AOT.
2. Expand the security > duties > smaServiceOrderProgressInquire
node.
3. Open a second AOT.
4. Expand the security > privileges >
smaServiceOrderMarginGenerate node.
5. Drag-and-drop the privilege to the duty.
6. Click Start > Power button options > Switch User
7. Press Ctrl-Alt-Delete to log on
8. Click Other User
9. Log on as Tony, password Pa$$w0rd.

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 2012


10. Run the Dynamics AX client.
11. View the changes in Tony's access.
12. Switch user back to Administrator

Security Privileges Form: Duties


The security privileges form displays information about the privileges and
permissions associated with a duty in the rich client.
Both duties and privileges can be viewed in this form. When a duty is selected,
the form includes the following information:

All existing Duties are listed in the left pane of the form. Duties are
grouped by Process cycle.

The AOT name for the selected duty is displayed at the top center of
the form together with the name and description. The AOT name is
the object name displayed in the AOT.

The Privileges pane in the bottom center of the form displays the
privileges that are associated with the selected duty.

The FactBox pane contains three FactBoxes that display related


information.
o
o
o

4-10

Roles with selected duty display other roles containing the duty
that is currently selected.
Privileges with selected permission(s) is only used when this
form is used to view a privilege.
Users' assistance hint provides help for a system administrator
editing security from this form.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 4: Security

The Action Pane includes various actions including creating,


deleting, copying or pasting duties and permissions.

FIGURE 4.4 SECURITY PRIVILEGES FORM

Security Privileges Form: Privileges


When an end-user expands a duty in the tree, a list of privileges associated with
the duty displays on the left side of the form. When a privilege is selected, the
form includes the following information:

The AOT name for the selected privilege is displayed at the top
center of the form together with the name and description. The AOT
name is the object name displayed in the AOT.

The Permission pane in the bottom center of the form displays the
permissions that are associated with the selected privilege.

The FactBox pane contains three FactBoxes that display related


information.
o
o
o

Roles with selected duty display other roles that contain the
duty that is currently selected.
Privileges with selected permission(s) displays a list of
privileges associated with the selected role.
Users' assistance hint provides help for a system administrator
editing security from this form.

The Action Pane includes various actions including creating,


deleting, coping or pasting duties and permissions.

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 2012

Assign a Permission to a Privilege


The assignment of permissions to privileges is typically maintained by a
developer in the AOT; however this can also be maintained by a system
administrator in the Security privileges form in the rich client.
Menu items and web content items can be dragged-and-dropped onto the entry
point node on a privilege in the AOT. The permission level is set on the
properties.

Procedure: View Permissions


Scenario: Chris wants to view the permissions included in the privilege Maintain
customer records (financials) which is assigned to the duty Maintain customers.
1. Open the AOT.
2. Expand the security > privileges > custTableMaintain > Entry
points node. Chris can view all of the menu items and web content
items that this privilege permits access to.
3. Click CustTable and view the Properties. The properties show the
object type is a MenuItemDisplay, the object name is CustTable and
the access level is Delete.
4. Collapse Privileges and Security.
5. Expand Forms > CustTable > Permissions. The possible access
types are listed and include read, update, create and delete.

Investigate Access
Auditing security can be a difficult task. Security tools are provided to assist in
this process.
The security roles and security privilege forms in the rich client provide
FactBoxes that give further information about the relationships between
permissions, privileges, duties and roles.
Tools are also available within the AOT to view from a menu item, all related
security roles and objects. This is useful if you need to know all users who have
access to a particular form, report or action.

4-12

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 4: Security
Procedure: View All Roles with Access to CustTable
Form.
Scenario: Chris wants to know all roles that have access to the customer list page.
1. Open the AOT.
2. Expand the Menu items > Display node.
3. Right-click CustTableListPage and click Add-ins >
Security Tools > View related security roles.
4. A list of all roles with access to the Customer table list page is
displayed.

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 2012

Lab 4.1 - Create a New Security Role


Scenario
June Low is employed in the new role of veterinary receptionist. June will be
receiving patients at the front desk and will need access to maintain customer
information and pet information. She will also need to view breeds and species.
Chris, the IT Engineer, needs to create a new role for the veterinary receptionist
and add duties so that she can access these areas of the application. June is
already created in Microsoft Dynamics AX and is assigned the system user and
employee roles. Chris needs to assign her the new role.

Challenge Yourself!
Create a new a new role and assign it to June with the following duties:

Maintain customers

Maintain pets

Maintaining pets requires the following privileges:

Maintain pets

View pet types

Step by Step
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.

4-14

Open the AOT.


Expand Security > Privileges.
Right-click Privileges and select New Privilege.
In Properties change the name to MaintainPets and the label to
Maintain pets.
Right-click Privileges and select New Privilege.
In Properties change the name to ViewPetTypes and the label to
View pet types.
Expand Maintain pets to display Entry points.
Open a second AOT.
Expand Menu items > Display.
Drag-and-drop vetCustPetTable to the entry points node and
specify Delete access in the property sheet.
Expand View pet types to display Entry points in the first AOT.
Drag-and-drop vetSpeciesTable to the entry points node and specify
Read access in the property sheet.
Expand Security > Duties.
Right-click Duties and select New Duty.
Rename the new duty to MaintainPets.

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 4: Security
16. Set the Label property to Maintain pets.
17. Drag-and-drop the MaintainPets privilege to the Maintain pets duty.
18. Drag-and-drop the ViewPetTypes privilege to the Maintain pets
duty.
19. Expand Security > Process cycles.
20. Drag-and-drop the Maintain pets duty to the TaxRevenue cycle.
21. Open the Security roles form in the rich client.
22. Click New.
23. Specify the AOT name VetReceptionist and the description of the
Veterinary receptionist.
24. Click the Add button.
25. Expand Revenue cycle.
26. Select Maintain pets.
27. Select Inquire into customer master.
28. Click Close.
29. Click Assign users in the Action Pane.
30. Select the Vet Receptionist role.
31. Click the Manually assign button.
32. Select June and click Assign to role.
33. Click Close.

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 2012

Summary
This course showed how to set up a new user, assign a user to a role, change
duties on a role, change privileges on a duty and assign permissions to a
privilege.

4-16

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 4: Security

Test Your Knowledge


1. Match the following item with the correct description:
_____ 1. A group of privileges
_____ 2. A group of duties
_____ 3. A group of
permissions

a. Role
b. Privilege
c. Duty

2. What are the base roles which every internal employee should be assigned?
(Select all that apply)
( ) System administrator
( ) System user
( ) Employee
( ) Vendor
3. Which of these are entry points? (Select all that apply)
( ) Web content items
( ) Menu items
( ) Forms
( ) Service operations

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 2012

Quick Interaction: Lessons Learned


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

2.

3.

4-18

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

Chapter 4: Security

Solutions
Test Your Knowledge
1. Match the following item with the correct description:
c 1. A group of privileges
a 2. A group of duties
b 3. A group of
permissions

a. Role
b. Privilege
c. Duty

2. What are the base roles which every internal employee should be assigned?
(Select all that apply)
( ) System administrator
() System user
() Employee
( ) Vendor
3. Which of these are entry points? (Select all that apply)
() Web content items
() Menu items
( ) Forms
() Service operations

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement

4-19

Development I in Microsoft Dynamics AX 2012

4-20

Microsoft Official Training Materials for Microsoft Dynamics


Your use of this content is subject to your current services agreement