Tuesday, 3 March 2015

How to Open same form on Different Parameters(Enum Parameters) in ax 2012

Create a menu item and set the following properties

EnumTypeParameter  : <Enum Name> (Enum Name that you want to use)
EnumParameter           :<Enum Value> (Enum value to filter form data)

Now Go to form that you want to open.

Override init() method on form and write the code



public void init()
{

    If(!Element.args().menuItemName())
    throw Error('Active Buffer Required');

    Nature = element.args().parmEnum();   // Nature is the buffer of your enum
    super();
}

To filter the record on the basis of Enum Value
Go to form Datasource method and override init() method and write the below code


public void init()
{
    super();

    this.query().dataSourceTable(tablenum(<Table Name>))
    .addRange(fieldnum(<Table Name>,  <field Name>)).value(enum2str(Nature));

}





No comments:

Post a Comment