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.


  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. public class SSRSDemoUIBuilder extends SrsReportDataContractUIBuilder
  8. 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:
    • public void build()
          DialogGroup dlgGrp;    
          //get the current dialog
          Dialog      dlg = this.dialog();       
          //make required modifications to the dialog
          dlgGrp = dlg.addGroup('Dates');  
          dlgGrp = dlg.addGroup('Customer');  
    • 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:
    //get the report data contract object
    contract = this.dataContractObject();
    //associate dialog field with data contract method
    this.addDialogField(methodStr(SSRSDemoContract,parmCustGroupId), contract);
  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:
  • public void lookupCustGroup(FormStringControl _formStringControl)
        Query query = new Query();
        QueryBuildDataSource DS;    
        SysTableLookup sysTablelookup;
        //create a table lookup    
        sysTablelookup = SysTableLookup::newParameters(tableNum(CustGroup),_formStringControl);
        //create a query
        DS = query.addDataSource(tableNum(CustGroup));
        //assign the query and call lookup
  • Now, override the postBuild method and write the following code:
  • public void postBuild()
        DialogField dlgCustGroup;
        //get the field to override by providing the data contract object and the associated attribute/method
        dlgCustGroup = this.bindInfo().getDialogField(this.dataContractObject(),
        //register the method we want to override
              methodStr(FormStringControl, lookup),
  • 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


Email [email protected] with any questions you have pertaining to this course.

New CPE Accredited Courses Now Available for Dynamics AX, GP, and NAVEARN CREDITS TODAY