Microsoft DynamicsAXPortal Development Script
Demo Overview
- Introduction
Microsoft Dynamics AX Enterprise Portal is being transferred to the ASP.NET framework. This framework brings rich interactive UI and leverages all the innovations happening on the Web. It provides developers with a rich toolset and platform technologies.
The purpose of this demo is to show how to create aCustomerOverview page using the new ASP.NET based framework for Microsoft Dynamics AX 5.0 Enterprise Portal and showthe advantages of using this framework.
- Audiences
The audience for this demo can be anyone who needsto understand the new ASP.NET based framework. This couldincludeASP.NET developers.
- Scenario
- Personas
- Tim Jones – Director of Sales
- Kate Light – Developer
- Story
- Purpose of Demo
- How to create a Web module and deploy it
- How to create a data set and set up user control
- How to create Web pages and Web parts
- How to create basic navigation
- Setup/ Prerequisites
This demo requires the following software to be installed:
- Microsoft Windows SharePoint Services 3.0
- Role Center and EP Framework
- Enterprise Portal Tools
Demo
Presenter’s Discussion Points / Actions Taken1. Create Web module
First, Kate creates a new Web module.
Before deploying the module, she can specify its properties:
- NeededAccessLevel
- ConfigurationKey
- QuickLaunch
- InheritNavigation
- InheritPermissions
- ShowLink
Kate deployed a module where the Web page with customer information will be displayed. / In the Microsoft Dynamics AX open the AOTby pressing CTRL+D.
Navigate to the Web\Web Modules\Home node.
Right-click the Home node and select NewSub module to create a new module.
Navigate to the newly created module and press ALT+ENTER to open theProperties palette.
Set NametoLTCModuleand in the Labelfield, select label with the Sales department.text.
Right-click the LTCModulemodule and select Deploy.
2. Createthe user control based on the data set
To complete the task, Kate should prepare the components that will serve as the base for the new page. These are:
- Data set the data for the Web page will be taken from
- User control that will be used for displaying data
Right-click the Data Sets node and, click New Data Set.
Rename the newly created data set to CustTable.
Next, Kate adds data sources to the data set. As the Web page must display data on customers, she adds the CustTable and CustGroup tables. The next step is to join the data sources.
The JOIN clause combines records from two tables in a relational database, resulting in a new, temporary table, sometimes called a "joined table". JOIN is an SQL operation that relates tables by means of values common between them.
The following types of links exist:
Passive
Linked child data sources are not updated automatically. Updates of the child data source must be programmed on the active method of the master data source.
Delayed
A pause is inserted before linked child data sources are updated. This enables faster navigation in the parent data source because the records from child data sources are not updated immediately. For example, the user could be scrolling past several orders without immediately seeing each order line.
Active
The child data source is updated immediately when a new record in the parent data source is selected. Continuous updates consume a lot of resources.
InnerJoin
Selects records from the main table that have matching records in the joined table and vice versa. There is one record for each match. Records without related records in the other data source are eliminated from the result.
OuterJoin
Selects records from the main table if they have matching records in the joined table.
ExistJoin
Selects a record from the main table for each matching record in the joined table. The differences between InnerJoin and ExistJoin are as follows:
When the join type is ExistJoin, the search ends after the first match has been found. When the join type is InnerJoin, all matching records are searched for.
NotExistJoin
Select records from the main table that do not have a match in the joined table.
Kate selects theInnerJoin type.
Other properties of the data source:
AllowCheck, AllowEdit, AllowCreate, AllowDelete– usually these should be set to Yes, but you should decide what is appropriate for your application. Set to No for lookup forms. AllowCheck on joined data sources (inner, outer, exist, not exist) must be set to Yes (which is the default) to enforce security checking across all data sources. / Open a new instance of the AOT by pressing CTRL+D and navigate to the Data Dictionary\Tablesnode.
Drag the CustTable and CustGroup tables to the Data Sources node of our newly created data set in the first AOT instance.
To make a connection between these two tables, select the CustGrouptable under the Data Sources node of the CustTable data set and press ALT+ENTER to open the Properties palette.
Set the JoinSource property to CustTable and the LinkType property to InnerJoin.
Save your changes by clicking Save All.
Next, Kate creates a user control grid in Visual Studio.She opens EP layer in VS. / Start Microsoft Visual Studio 2008 and open the existing Web site by clicking FileOpenWeb site.
In the left part of the Open Web Site dialog box, click Local IIS.In the right part of the dialog box, under Local Web Servers, expandEP-36195_layoutsep and click Open.
A dialog box appears informing that the Web site is not marked as an application in IIS. Confirm that the Web site must be opened anyway.
In Solution Explorer, right-click the opened site and select Add New Item.
Under My Templates, selectDynamics AX User Control.
In the Name field,type CustTableUC.
Click Add.
After the control is created, Kate adds a data source to it. / Double-click the newly created control and open the Toolbox. ClickDesign.
From the Dynamics AX 5.0group, drag AxDataSource to the Design window of the CustTableUC control.
In the Properties, set ID and DataSetName to CustTableDS and CustTable accordingly.
Next, she adds a grid view to the control. / Then, add the grid view.
From the Dynamics AX 5.0 group, drag AxGridView to the Design window of the CustTableUC control.
In the Properties, set ID and DataSourceID to CustTableGridView and CustTableDS accordingly. The DataKeyNames and DataMember properties will be set up automatically.
After the grid is added, Kate adds columns to it. She selects columns to display customer account number, customer name and group.
This is done in the Dynamics AX Bound Field Designer available after clicking Edit Columns in the Tasks pane.
The BoundField control is used by data-bound controls (such as GridView and DetailsView) to display the value of a field as text.
Note that if there is a join, the DataField property must be referred to as <datasourcename>!<fieldname>, for example CustGroup!Name. / To set up grid columns, click Edit columnsin the AxGridView Tasks window that becomes visible after clicking the arrow next to the grid control in the Design window of the CustTableUC control.
Clicking Add field, add the AccountNum, Name and CustGroup fields and click OK.
Save the user control that you have just created.
3. Create a Web page
Next, Kate creates a Web page for the controls that she has created. To do this, she uploads the user control to the AOT. / To upload the user control to Microsoft Dynamics AX, right-click the control and click Add to AOT.
The control will be located in the AOT underthe Web\Web Content\ManagedandWeb\Web Files\Web Controls nodes.
Katecreates the Web content and Web page. She opens the Enterprise Portal, clicks Site ActionsCreate, and specifies properties for the page to be created. / To open the Enterprise Portal home page, click Administration Setup Internet Enterprise portal Web sites. Click View in Browser.
Create a new page by clicking Site ActionsCreate and then choose Web Part Page in theWeb Page section. TypeCustTableas a name for the page,select the Header, Left Column, Body template and select Enterprise Portal as the Document Library.
Click Create. This will open the new page in the Editing mode.
After Kate clicks OK, the page is opened in the Editing mode. She adds a Web part – the grid created before. /
In the Body section, click Add a Web Part.
In the Add WebParts dialog box that opens, in the Miscellaneous section, select the Dynamics User Control WebPart. Click Add.
In the Body section, click Edit next to the addedDynamics User Control Web Part. ClickModify Shared Web Part.
In the Dynamics AX section, set the Managed content item property to CustTableUC (the WebContent created previously). Click OK.
The following values are available for theWeb part role to one of the following values:
- None – Not connected to any other Web part onthe page
- Provider – Provide the record context of the selected/current item to other Web parts
- Consumer – Consumer the record context and refreshes the context
Next, Kate adds a toolbar to enable creation and editing of the existing customer information, and then connects it with the grid control
After doing this, Kate exits the Edit mode to see the result. The Web page with the customer information is now available for the sales persons. / In the Body section, click Add a Web Part.
In the Add WebParts dialog box that opens, in the Miscellaneous section, select Dynamics Toolbar WebPart. Click Add.
In the Body section, click Edit next toDynamics Toolbar WebPart, and select Modify Shared Web Part.
In theDynamics AX section, set the Web menuproperty to EPCustTableInfo.Click OK.
Next to Dynamics Toolbar Web Part, click Edit and then clickConnectionsGet AxContextList FromDynamics User Control WebPart.A checkmark next tothe Connectionswill appear.
In the Site Actions menu located at the top right corner, click Exit Edit Mode.
1