Form Declaration in a class in AX2012

Hello to All,

I am getting an issue, I have to create a form with 2 Buttons(for example), then i have to write a code in class to Enable/Disable the button1 and have to keep this class in Button2 by calling the class in Button2’s clicked method, means to Enable/Disable the Button1 using Button2 but through a class.

But while declaring my Form in a class i am getting an error–>“Err:9999”.

SO how to solve this issue, how can i use my form in a class.

Thanks & Regards


Forms are not types in Dynamics AX, so you can’t use their names as types of variables. But you can declare the variable as FormRun (all forms are instances of this class).

Hello Martin,

Then how can i perform my work, means how can i use the form control(button) in my class. please suggest me.

Thanks & Regards


Buttons are instances of FormButtonControl class. You can pass the instance to your class from form’s init() method, for example.

Usage is exactly the same as from code on form - you’ll need enabled() method in your particular case.

Thanks Martin…