I need to call a report by clicking a menuitembutton which is created in runtime.
Can anyone teach me how I can achieve this? I’m using AX 2009.
Many Thanks,
I need to call a report by clicking a menuitembutton which is created in runtime.
Can anyone teach me how I can achieve this? I’m using AX 2009.
Many Thanks,
Is this menuItemButton created at RunTime?? If YES - Call this method in the init method of form: element.controlMethodOverload(true);
and Create new method with the control name as Prefix to call the clicked method for the button:
void ControlName_clicked()
{
new menufunction(menuitemdisplaystr(“reportObject”), menuitemtype::output);
}
To call a report’s menu item , use this one :
menu Function menu Function;
;
menu Function = new menu Function(reportStr(Cust), MenuItemType::Output);
menuFunction.create();
menuFunction.run();
if you need to call a report when clicking on a button
void clicked()
{
Args args = new args();
ReportRun reportRun;
;
args.name(reportstr(PurchRequisitionDetails));
reportRun = classFactory.reportRunClass(args);
reportRun.init();
reportrun.run();
super();
}
Regards,
Nagaraj
If it’s a menu item, the target of the menu item will be called automatically on click. What else do you need?
Dear All,
Thanks for the replies!
Vishal, I used some codes suggested by you in method “public void init()”
FormButtonControl _button;
element.controlMethodOverload(true);
super();
_button = menuButton.addControl(FormControlType::Button, #button);
_button.text(“text”);
_button.helpText(“help text here”);
_button.autoDeclaration(true);
This part is OK, I can created the button in runtime, thank you!
Also, I used the codes from Nagaraj, method “void button_Clicked()” was created in form Methods node.
However, error message “Variable Args has not been declared.” was returned once I saved the code.
Any suggestion?
Regards,