This article is for understanding what’s going on behind the scene when you want to do Microsoft Dynamics Ax 2009 Enterprise Portal (EP) customization. This article also explains how to start with the EP development using Visual Studio 2008 (recommended method of doing all new EP development).
Most of the complex functionality of EP is developed by using Visual Studio 2008. You do EP development by using the Enterprise Portal framework and Visual Studio. You can use this framework and Visual Studio to customize existing controls for EP or to create new controls. EP functionality is deployed by creating managed User Controls in Visual Studio. Adding or modifying the code for User Controls in EP is like editing code for standard ASP.NET controls
Step 1: Ax AOT development
Create a method which will accept the related parent field value and if that record does not exists in Ax it will create a new record for the related field value than do execute query on the table. Name this method as DataSetMethodName1, we will use this in Step 3.
Step 2: Create a Visual Studio Web Project
- Start Visual Studio.
- In the File menu, click New, and then click Web Site.
- In the New Web Site window, select .NET Framework 2.0 as the framework version to use.
- Set the Location to File System and the Language to Visual C#.
- Choose Dynamics AX Web Project as the template to use. If you do not see this project template, be sure that you have the EP Tools installed. These tools include three components… Visual Studio add-in, Project templates & Toolbox components. When EP Tools are installed for Visual Studio, the Visual Studio environment is automatically reconfigured to make the tools available.
- Specify the name and location of the folder where you want to store the files for the Web project.
- Click OK to create the Web project.
- If a dialog box displays asking whether to upgrade the Web site to the .NET Framework version 3.5, click No.
Step 3: Modify User Control
- Find the User Control to modify
You must find the name of the specific User Control in EP before you can edit it.
- In EP, navigate to the page that contains the Dynamics User Control Web part that you want to modify.
- In the Site Actions menu, choose Edit Page.
- In the Edit menu for the Web part, choose Modify Shared Web Part. The properties and settings for the Web part displays.
- Examine the Managed content item property. This is the User Control that you want to modify.
- Modify the User Control
Edit the user control found in above step in Visual Studio.
- Start Visual Studio.
- Open the Web project that you created in Step 2: Create a Visual Studio Web Project to use to modify the User Control.
- Right-click the Web site in Solution Explorer, and then click Add User Control from AOT. The Pick Web Controls window displays.
- Locate the User Control in the User Controls list and move it into the Selected Controls list.
- Click OK to add the User Control (.ascx file) to the Web project.
- Open the .ascx file. Check the tools available for Dynamics Ax in the toolbar.
- Add AxDataSource (provides access to a data set in the AOT) from the Dynamics ax toolbar
Choose the data set created in Ax in step 1.
- Add AxSection (container for groups of other controls) at the desired location. For this example add this below Overview section.
- Add AxForm (displays data from an AxDataSource in a form layout for a User Control) and set data source to the name of AxDataSource added above.
Optionaly you can set DataKeyNames property to the RecId,PrimaryKey.
Set From’s display mode by AxForm.ChangeMode() function in the code at the time of page_load.
- Add AxGroup (container for fields in a form) and in it’s Fields property, select bounded fields to be displayed on the form.
- Add a button to update the form data. And on it’s button clicked event add axForm1.UpdateItem(true);
- See, till now we have not linked our datasource to the page’s main data record.
For this add this code in page_load event:
RunDataSetMethod(this, axDataSource1, “DataSetMethodName1”, RelatedRecId);
I hope this article helped you starting the Dynamics Ax 2009 EP development. In my next article I will explain how to create a new User Control.