Академический Документы
Профессиональный Документы
Культура Документы
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
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.
• 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
Chapter 3: User Interfaces
From the application workspace main menu, navigate to Accounts Receivable >
Customers > All customers.
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
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.
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
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.
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
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.
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
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.
Here is a more simple form with a grid section and some additional fields at the
bottom.
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.
3-8
Chapter 3: User Interfaces
Expand the Data Sources node for the PriceDiscTable form and view the
properties for the PriceDiscTable data source.
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
Development I in Microsoft Dynamics® AX 2012
1. In the AOT, right-click the Forms node and select New Form.
2. Rename the form to VetSpeciesTable.
3. In a second AOT, locate the table VetSpeciesTable.
4. Drag the table VetSpeciesTable to the DataSources node on the
VetSpeciesTable form.
5. Expand the Designs node on the VetSpeciesTable form.
6. Right-click the Designs node and select New Control > Grid. A
new Grid control is created.
7. Expand the DataSources > VetSpeciesTable > Fields node.
8. Drag the fields SpeciesId and Name to the grid control.
9. On the properties sheet for the Design node, in the Caption property,
enter "Species".
10. Save your changes to the form.
11. Open the form by pressing Ctrl+O.
12. Populate the table by entering your own data in to the form.
3-10
Chapter 3: User Interfaces
Scenario
Challenge Yourself!
Create a new form that can be used to view, create and edit records in the
VetBreedTable table.
Step by Step
1. In the AOT, right-click the Forms node and select New Form
2. Rename the form to VetBreedTable.
3. In a second AOT, locate the table VetBreedTable.
4. Drag the table VetBreedTable to the DataSources node on the
VetBreedTable form.
5. Expand the Designs node on the VetBreedTable form.
6. Right-click the Design node and select New Control > Grid. A new
Grid control is created.
7. Expand the DataSources > VetBreedTable > Fields node.
8. Drag the fields BreedId and Name to the grid control.
9. On the properties sheet for the Design node, in the Caption property,
enter "Breed".
10. Save your changes to the form.
11. Open the form by pressing Ctrl+O.
3-11
Development I in Microsoft Dynamics® AX 2012
3-12
Chapter 3: User Interfaces
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
Development I in Microsoft Dynamics® AX 2012
3-14
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.
Examples of Templates
The following table gives examples of each form template
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
Development I in Microsoft Dynamics® AX 2012
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
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.
• 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.
3-17
Development I in Microsoft Dynamics® AX 2012
3-18
Chapter 3: User Interfaces
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.
3-19
Development I in Microsoft Dynamics® AX 2012
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.
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
Chapter 3: User Interfaces
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
Development I in Microsoft Dynamics® AX 2012
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
Chapter 3: User Interfaces
1.
2.
3.
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
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