Dynamics Search Engine

Monday, January 19, 2009

How to convert Microsoft Dynamics Ax Web form to use ASP.Net-based framework for Ax Enterprise Portal

Disclaimer: There is no warranty for this article. Use at your own risk.
Applied on: Ax 2009 SP1

  • You should have Dynamics Ax 2009 SP1 installed with Enterprise Portal
  • Visual Studio 2008 should be installed.
  • You should have basic knowledge of Dynamics Ax, Visual Studio, X++ and C#
  • You should have knowledge of previous version Dynamics Ax Enterprise Portal

This article explains:
  • How to convert Microsoft Dynamics Ax Web form to use ASP.Net-based framework for Ax Enterprise Portal.
  • How to use the Web Form Converter class.
  • How to convert Enterprise Portal Content.
  • How to convert a Web form to user control.
Enterprise Portal for Microsoft Dynamics AX 2009 uses a new framework based on ASP.NET.
User Controls created by using this framework are the primary method for adding functionality to Enterprise Portal. Visual Studio is used to develop or customize User Controls.

In earlier versions of Dynamics AX Enterprise Portal, Web forms and Web controls were the primary method to provide functionality. While Web forms and Web controls are still supported, but Microsoft recommends that any new development for Ax Enterprise Portal to be done with Visual Studio and the ASP.NET-based framework.

If you have created Web forms for an earlier version of Dynamics AX Enterprise Portal, you can convert them to use the new ASP.NET-based framework. A Web Form Converter class is available that can take an existing Web form and convert it into components that can be used with the new Enterprise Portal framework.

To convert a Web form to use the ASP.NET-based framework for Enterprise Portal, you must first add the SysEPWebFormConverter class to your Microsoft Dynamics AX installation. Then you will use methods in this class to perform the conversion.

The SysEPWebFomConverter class contains several methods that are used when you convert a Web form from an earlier version of Enterprise Portal to the components used with the ASP.NET-based framework. You can find the codes of this class from MSDN or you can download the XPO of this class from here. Download this zip file and extract it. Import the extracted XPO file to your application [Note: Applied on Ax 2009 SP1].

To add the SysEPWebFormConverter class
  1. If you use the MSDN code then instructions are there how to do it.
  2. If you download the above said zip file then extract the zip file.
  3. Open your Microsoft Dynamics AX application, open the AOT.
  4. Click the Import button to open the Import form.
  5. Click Browse and select the SharedProject_SysEPWebFomConverter.xpo file that you extracted.
  6. Click OK to start the import process. The class will be added to the AOT.
How to using the Web Form Converter Class
To use the Web Form Converter class, you will specify which Web forms you want to convert.
  1. In the AOT, expand the Classes node.
  2. Locate the SysEPWebFormConverter class. Expand the node for this class.
  3. Right-click the getFormsToConvert method for the class, and then click Edit.
  4. In the script for this method, specify the Web forms that you want to convert. Replace WebForm1 and WebForm2 with the names of the Web forms to be converted. If necessary, add more lines for additional Web forms.
  5. Click Save to save the changes.
  6. In the AOT, right-click the main method for the class, and then click Edit. This is the main code that performs the conversion. It retrieves the list of Web forms to convert, performs the conversion, and then adds the resources that were created to a new project.
  7. Specify the name of the project to be created. By default, the project created will be named WebForm_Conversion. You can change this name if needed.
  8. Click Save to save any changes to the script.
  9. Right-click on the SysEPWebFormConverter class and click on Open to perform the conversion. The new project will be displayed that contains the new resources that were created.
  10. To use the new Web Controls that were created, you must deploy them to the Enterprise Portal server. In the AOT, expand the Web node, and then expand the Web Files node. Right-click the Web Controls node, and then click Deploy.
  11. After the conversion is complete, you should verify that the new components are working correctly.

To view a new User Control in Enterprise Portal, add a Dynamics User Control Web part to an Enterprise Portal page as add Dynamics Web Form Web part. Select the new User Control as the managed content item to display.

To view a User Control in Visual Studio, create a new project as described below:
  1. Start Visual Studio.
  2. In the File menu, click New, and then click Web Site.
  3. In the New Web Site window, select .NET Framework 2.0 as the framework version to use.
  4. Set the Location to File System and the Language to Visual C#.
  5. Choose Dynamics AX Web Project as the template to use. If you do not see this project template, be sure that you have the Enterprise Portal Tools installed.
  6. Specify the name and location of the folder where you want to store the files for the Web project.
  7. Click OK to create the Web project.
  8. If a dialog box displays asking whether to upgrade the Web site to the .NET Framework version 3.5, click No.
  9. The Web Form Converter provides a starting point for converting Web forms to User Controls for Ax Enterprise Portal. You may have to use Visual Studio to modify the User Controls that were created by the conversion to achieve the results that you want.
Hope this article is helpful for you.
I will post in a separate article how to modify a user control for Ax Enterprise Portal.

1 comment:

  1. Hi, I've got a problem when I try to edit and Web User Control that has been converted by this converter. When I try to add it in the VS from the AOT, the web user control doesn´t appear. The others web control created directly from VS do'esnt appear either. I have tested it in 2.0 Framework and in 3.5.