26 July 2012

AX 2012 view and edit mode

To find out if an AX 2012 form is in view or edit mode just call:

element.inViewMode();

To catch the event of changing the mode you have to override the task() method of the form and check the value of the _taskId.

public int task(int _taskId) 

    #task 
    int ret;

    ret = super(_taskId); 

    if (_taskId == #taskEditRecord) 
    { 
        info("edit or view mode?"); 
    } 

    return ret; 
}

25 July 2012

Calling a MenuItem

This post is just for me to remeber these lines of code ;)

MenuFunction menuFunction = new MenuFunction(menuitemdisplaystr(MENUITEM), MenuItemType::Display); 
Args args = new Args(); 

args.caller(element); 
args.record(DS); 
menuFunction.run(args);

24 July 2012

Dynamics AX BaseEnums in SSRS Reports

In SSRS AX BaseEnums are represented by two fields in the DataSet


Normally there is one with the "name" of the BaseEnum that represents the name of the element and another one called "name1" that contains the label of the element. In some cases this is switched around. So that "name" contains the label and "name1" contains the name of the element.
The only way to notice that is to have a look at the Alias. There you can see LABEL or NAME.

23 July 2012

How to sign a Dynamics AX model file

To sign a model file you need an SNK file. If you don't have one just generate a key pair with the following command:

C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe -k YOURKEYFILE.snk
/(in older Versions it also could be in v6.0A) 


After that the snk file can be used to sign the model that is exported from an AOS. Make sure to set the client config to the right AOS and than just use the following command:

AxUtil export /model:NAMEOFTHEMODEL /file:MODEL.axmodel /key: YOURKEYFILE.snk