Using UI Builder Class to Develop SSRS Reports in Microsoft Dynamics AX 2012

UI Builder Class Overview

User Interface (UI) Builder Class is used to define the layout of the parameter dialog box that opens before a report is run in Microsoft Dynamics AX. It is used to add the customizations as well as additional fields in the dialog.

Following are the scenarios where UI Builder Class can be used:

  1. Grouping dialog fields
  2. Overriding dialog field events
  3. Adding a customized lookup to a dialog field
  4. Binding dialog fields with Report contract parameters
  5. Changing the layout of the dialog
  6. Adding custom controls to the dialog

To create a UI builder class, extend it with SrsReportDataContractUIBuilder.

Pre-requisites

  1. Microsoft Dynamics AX 2012
  2. Reporting services extensions must be installed in Dynamics AX
  3. Report contract class

Sample UI Builder Class

  1. Create a new class. Open AOT à Classes
  2. Right Click on Classes and select New Class. Name it as SSRSDemoUIBuilder
  3. UI builder class example in microsoft dynamics ax 2012

  4. Open the Class declaration by right clicking on it and selecting View code
  5. UI builder class example in microsoft dynamics ax 2012

  6. Write the following code
  7. Now open the contract class and add the following line to the header of the class. It will tell the contract class to build the parameter dialog. In other words, it will link the UI Builder Class with the contract class.

Examples of UI Builder Class Usage

Based on different scenarios, different methods are overridden as shown in the following examples:

  1. Grouping the dialog fields/Changing the layout of the dialog/Adding custom controls to the dialog
    • To customize the layout and add custom fields, override the build as shown below:
    • ThIS build method is called by the report framework to generate the layout of the dialog.

  2. Binding dialog fields with Report contract parameters
    • Write the following code in the build method:

  3. Overriding dialog field events/Adding a customized lookup to a dialog field
  • To add a customized lookup or to override a control method, create a new method containing the business logic. The new method must have the same signature as the method you want to override.
  • Then, override the postBuild method and register the method to override with the new method created.
  • In the following example, the lookup method of a field is to be overridden. To do this, create a new method lookupCustGroup and add the following code:
  • Now, override the postBuild method and write the following code:
  • bindInfo returns an object of type SysOperationUIBindInfo. It contains information about the dialog controls bounded to a report contract.
  • postBuild method is called when dialog is created.
April 28, 2014