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));

}





How to Color grid in ax 2012

In this post you can find how to color a grid on specific value or condition

On your form override a method on form datasource called

DisplayOption()

Now write code on displayOption Method.

public void displayOption(Common _record, FormRowDisplayOption _options)
{
A_Table1_1      A_Table_Local;
A_Table_Local = _record;

    if(A_Table_Local.AccountNum == '1' || A_Table_Local.AccountNum == '5')
    {
        _options.backColor(65408); //Light Green
        _options.affectedElementsByControl(A_Table1_1_AccountNum.id());
      // the code is for cell specific coloring
    }
    else
    {
        _options.backColor(6029311); //Light Yellow
        _options.textColor(12582912); //Blue
     // for row color
    }
}

Done....!!!!

Monday, 2 March 2015

Export / Import Labels Files (.ald) files in ax 2012

For Export :


Step 1 : Go TO > AOT > LabelsFiles > expand node > go to labels (that you want to export) > Languages >

Step 2 : Then Select language with ald file (label files) > Right Click on it and select option export to Label file

Step 3 : It will ask you for location . Give the Location and Click OK.



For Import :

Step 1 : Go to > AOT > LabelsFiles >

Step 2 : right click on it and select option Create from File.

Step 3 : It will ask you for location from where you get .ald file then ckick OK.


Location of .ald file in system :

C:\Program Files\Microsoft Dynamics AX\60\Server\<Application Object Instance>\bin\Application\Appl\Standard