Beruflich Dokumente
Kultur Dokumente
DEVELOPMENT I
IN MICROSOFT DYNAMICS AX 2012
Table of Contents
Introduction
0-1
Chapter 1: Architecture
1-1
2-1
3-1
Chapter 4: Security
4-1
ii
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:
0-1
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.
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.
0-2
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.
0-3
Student Objectives
What do you hope to learn by participating in this course?
List three main objectives below.
1.
2.
3.
0-4
Chapter 1: Architecture
CHAPTER 1: ARCHITECTURE
Objectives
The objectives are:
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.
1-1
Functional features
o
o
o
o
o
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.
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.
1-3
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:
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)
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.
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.
1-5
1-6
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.
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.
1-7
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:
Forms and Menus define how a user interacts with the application.
Classes and Methods are code objects that define business logic.
1-8
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:
A white paper titled "Selecting the Best Development Technology for your
Application Development Scenario AX2012" is available for download on
MSDN.
Forms define the layout of all of the forms. Forms are used to view
data in the Microsoft Dynamics AX client.
1-9
Menus define forms and reports that appear in the menu in the
Microsoft Dynamics AX rich client.
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
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.
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 Table browser displays data from all fields in a selected table.
The table browser can be used to run SQL statements.
1-11
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
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.
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:
1-13
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
GLS, GLP
FPK, FPP
1-14
Layer
Description
SLN, SLP
ISV, ISP
VAR,
VAP
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
USR, USP
1-15
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.
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
Chapter 1: Architecture
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.
To change the current model, click the current model in the status bar.
1-17
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
Chapter 1: Architecture
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.
1-19
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
Chapter 1: Architecture
a.
b.
c.
d.
CUS
VAR
SYS
ISV
1-21
1-22
Chapter 1: Architecture
2.
3.
1-23
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
1-24
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
1-25
1-26
Introduction
This chapter introduces the tools and procedures used to create tables, data types,
and relations that are required in Microsoft Dynamics AX.
2-1
2-2
Press Ctrl-Shift-W.
Press CTRL + D.
ALT + ENTER: Opens the properties sheet for the selected element.
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.
2-3
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
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.
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.
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.
2-5
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.
CustTable
VendTable
LedgerTable
The table for the general ledger that contains the chart of
accounts information.
InventTable
PurchTable
2-6
Fields
Field Groups
Indexes
Relations
Delete Actions
Methods
2-7
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
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.
2-9
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.
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.
Description
String
A number of characters.
Integer
Real
Date
Time
UTCDateTime
A combination of date and time types into one data type that
also holds time zone information.
2-11
Description
Enum
Container
GUID
Int64
Boolean
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.
2-13
2-14
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.
2-15
Creating Tables
Existing tables in Microsoft Dynamics AX can be modified or new tables can be
created using the MorphX tools in the AOT.
2-16
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.
2-17
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
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.
2-19
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.
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
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.
2-21
Relations
Relations between tables are used to associate rows in one table to rows in
another table.
Relations are also used to:
Look up values in other tables (using lookups and the View Details
command).
Generating field help (hover over a field, and data from the related
table is displayed).
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
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.
13.
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.
2-23
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
2-25
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.
The figure shows the Gender Base Enum, with the value of Male corresponding
to the integer value of 1.
2-26
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.
2-27
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
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
2-29
2.
3.
2-30
Solutions
Test Your Knowledge
1. Put the following steps in order to create a new Primary Index in a table.
Step:
6
2-31
2-32
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.
3-1
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.
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.
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
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.
3-3
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
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.
3-5
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
Here is a more simple form with a grid section and some additional fields at the
bottom.
3-7
3-8
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.
3-9
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.
3-10
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.
3-11
3-12
Menus Items
You can use menu items to activate application objects from the user interface.
Menu properties include the following:
Output and Action menu items are discussed in other training courses.
3-13
Object = CustTableListPage
3-14
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
DetailsFormMaster
DetailsFormTransaction
SimpleListDetails
SimpleList
Basic inquiry.
TableOfContents
Dialog
Examples of Templates
The following table gives examples of each form template
Form Template
Menu path
ListPage
DetailsFormMaster
DetailsFormTransa
ction
Sales and marketing > Common > Sales Orders > All
sales orders > Edit
SimpleListDetails
SimpleList
TableOfContents
Dialog
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.
3-15
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
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.
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.
The Action Pane contains menu items you can use to do typical
tasks related to the highlighted record.
3-17
3-18
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.
3-19
3-20
11.
12.
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.
3-21
3-22
2.
3.
3-23
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
Chapter 4: Security
CHAPTER 4: SECURITY
Objectives
The objectives are:
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.
4-1
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.
4-2
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.
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
Read
View
Update
Edit
Create
Create
Correct
Correcti
on
Delete
Full
control
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.
4-3
Duties
Duties are a group of related privileges required to perform a task.
Duties are grouped into the following six Process Cycles.
Conversion cycle
Expenditure 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
Chapter 4: Security
4-5
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.
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.
Chapter 4: Security
4-7
4-8
Chapter 4: Security
11.
12.
13.
14.
4-9
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.
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.
Chapter 4: Security
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.
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.
4-11
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
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.
4-13
Challenge Yourself!
Create a new a new role and assign it to June with the following duties:
Maintain customers
Maintain pets
Maintain pets
Step by Step
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
4-14
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.
4-15
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
Chapter 4: Security
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
4-17
2.
3.
4-18
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
4-19
4-20