9/29/2023

X++ code to open a form or menuitem AXAPTA

 X++ code to open a form or menuitem AXAPTA

How to open a form by using x++ code.

  1.  
  2. static void OpenDisplayMenuItem()
  3. {
  4.    Args args = new Args();
  5.    ;
  6.    args.record(VendTable::find('A-CSK'));
  7.    new MenuFunction(MenuItemDisplayStr(VendTable),MenuItemType::Display).run(Args);
  8. }


This Job will get the same result but with different approach by using formrun class.

  1. static void OpenForm()
  2. {
  3.    FormRun formRun;
  4.    Args args = new Args();
  5.    ;
  6.    args.name(formstr(VendTable));
  7.    args.record(CustTable::find('A-CSK'));
  8.  
  9.    formRun = ClassFactory.formRunClass(args);
  10.    formRun.init();
  11.    formRun.run();
  12.    formRun.wait();
  13. }

No comments:

Post a Comment