donderdag 15 juli 2010

Disable dialog button


public void disableDialogOkButton(DialogRunbase dialog)
{
    ;
    dialog.dialogForm().formRun().design().controlName('OkButton').enabled(false);
}

maandag 12 juli 2010

Forms Tutorial_Resources and SysImageResources

Source: http://www.artofcreation.be/2010/06/28/forms-tutorial_resources-and-sysimageresources/

Depending on what AX version you are using, the name of the form is different:

Dynamics AX 4: form Tutorial_Resources
Dynamics AX 2009: form SysImageResources

donderdag 8 juli 2010

Form caching of frequently called non-display method

To cache a method on a form, it must be a display method.
How do we cache a method "myMethod" that is NOT a display method?
We cannot use cacheAddMethod.

In general:
Classdeclaration:
Create a map that with
key = the recid of the current record of the form datasource
and value = the return value of "myMethod"

ExecuteQuery:
Empty your map.
suppose "myMethod" returns a string:

myMap = new Map(Types::Integer, Types::String)


[location where method is called]:
Look in the map if the recid exists.
If it exists, return that value.
If not exists, execute "myMethod", store in myMap with current recId, and return that value.

ReRead:
Remove the current recid from the map, so that the method will be re-executed next time.