How to call a form from runbase class?

Hi,

I created one runbase class, its working fine. but i developed like output wil display in infolog. but i need that output will show in new form instead of infolog. in AX 2009. Pls reply

Thanks in advance

You can save data to database and display them in a form, or send data directly to a form. Your class can open aform or you can do it in the opposite way - a form will call a class to prepare data for it (which is the usual case).

Don’t forget that RunBase is usually used to run logic on AOS and forms always run on client - don’t introduce any unnecessary performance issues. Also, if you wanted to run your class in batch, you wouldn’t have any client, therefore you couldn’t call a form from your class.

Sorry martin, may be you are not understand my question.

i created a runbase class and called the output in run() method for eg:

{

while select salesTable

where salestable.CustAccount == custAccount

join salesLine

where salesLine.SalesId == SalesTable.SalesId

{ info(strfmt(“CustAccount %1; SalesOrder No : %2; Item: %3; Quantity: %4 ; Status : %5 ; Currency : %6” , custAccount, salesTable.Salesid, salesLine.ItemId, salesLine.SalesQty, salesTable.DocumentStatus, salesTable.CurrencyCode));}

Instead of Info the result should be display in Form in AX 2009.

Thanks

Yes, yes, I know - that’s what my answer is about. What did you expect?

Thanks for your reply.

My expectation is the output will display in infolog in run() method after click ok button. but if i call instead of infolog by form using this(eg:" new MenuFunction(MenuItemDisplayStr(FilterSalesOrder),MenuItemType::Display).run();") it didnt work. how to call form with parameter after click ok button.

thanks in advance

run() accepts an instance of Args class. There you can send not only simple values, but also references to objects (including temporary tables, for example).

Thanks martin. That only i don’t know how to call the form with parameter in ths Runbase class. i tried with menu function but it didnt work.

If you tel, in which method i should call with parameter means really its helped me alot

Thanks

“Doesn’t work” is never sufficient description of any observed behavior. Surely the problem is not in AX kernel, it’s somewhere in your code, but because you didn’t explain what happened nor you showed you code, nobody can give you any advice.

There are other ways, of course, but won’t you do the same mistake again? Wouldn’t better to understand what you did wrong?

Hi martin,

I called this only in Run() method instead of above code but i didn’t work

args args = new Args();

args.record(SalesTable::find(custAccount)); //** Cust account pass the parameter value which is passed from combo box

new MenuFunction(MenuItemDisplayStr(FilterSalesOrder),MenuItemType::Display).run(Args);

Thanks once again for spending time

So what doesn’t work?

FilterSalesOrder form which is already created not open

Sorry, am new to dynamics that’s why these kind of questions asking to you.

Mode details! You have to do your part if you want others to spend time with your problem.

  1. Do you get any error?
  2. Your code is calling a display menu item - does it exist?
  3. Does it point to the right form?
  4. Aren’t you executing your code in batch, despite my warning?
  5. If you put a breakpoint to init() method of your form, does it get executed?

Yes, its work instead of calling in run method, i called the args and menu function in getfrom dialog method.

thank you so much!!