Sunteți pe pagina 1din 14

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

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


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

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

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

A-1

Development I in Microsoft Dynamics AX 2009

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

Decide on the Information Fields


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

Management's Information Requirements


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

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

Notes on Contact Methods


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

Basic Table Planning


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

A-2

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

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


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

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

Assigning Data Types


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

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

Field Label Assignments


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

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

A-3

Development I in Microsoft Dynamics AX 2009

Creating the Basic Data Objects


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

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

Creating the Base Enumeration for the Contact Type


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

A-4

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

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


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

FIGURE A.1 CONTACTMETHODS ENUMERATION

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

Creating an Extended Data Type


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

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

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

A-5

Development I in Microsoft Dynamics AX 2009


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

Memo fields CANNOT be used in WHERE clauses.

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

FIGURE A.2 HOW THE FRAMEWORK APPEARS

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

Creating the Account Number Relation


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

A-6

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

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


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

FIGURE A.3 COMPLETE FRAMEWORK

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

Creating the Graphical Components


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

Designing the Form


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

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

A-7

Development I in Microsoft Dynamics AX 2009


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

Creating the Form


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

A-8

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

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


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

Creating the Report


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

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

A-9

Development I in Microsoft Dynamics AX 2009


The following figure illustrates the updated AOT design.

FIGURE A.4 UPDATED FORM AOT DESIGN

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

FIGURE A.5 ADDING FIELDS TO THE BODY SECTION

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

A-10

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

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


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

FIGURE A.6 FINAL REPORT

Creating a Menu Item


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

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

A-11

Development I in Microsoft Dynamics AX 2009


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

FIGURE A.7 MENU STRUCTURE IN THE AOT

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

FIGURE 99.8 OPENING THE NAVIGATION PANE FROM THE TOOLBAR

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

A-12

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

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

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

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

A-13

Development I in Microsoft Dynamics AX 2009

Quick Interaction: Lessons Learned


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

2.

3.

A-14

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

S-ar putea să vă placă și