Wednesday, 4 February 2015

Passing Enum value between forms in ax 2012

Hi Daxers,

When working on forms you may need to pass an enum value between the forms.
We can pass the enum value to a child form by setting the enum type and enum value for the args of parent form and pass that args to the child form.

Syntax:
args.parmEnumType(enumNum(<enumName>));
args.parmEnum(<enumValue>);

For example,

Parent Form:
args.parmEnumType(enumNum(PrintCopyOriginal)); //Setting the enum Type.
args.parmEnum(PrintCopyOriginal::OriginalPrint); //Setting the enum value for specified enum type.

//pass this 'args' to the child form

Child Form:
args.parmEnum(); // Returns the enum value that was set.


Enjoy Daxing!