Hi,
Open Popup form from X++ code from display menu item in D365FO
create a menu item for the form that you want to open and use the normal way to secure the menu item with security. Then, you can launch the form using the menu item.
Args args = new Args();
;
args.record(VendTable::find("XYZ"));
new MenuFunction(MenuItemDisplayStr(VendTable),MenuItemType::Display).run(Args);
another sample
if (_args || _args.record() || _args.dataset() == tablenum(PurchTable))
{
PurchTable _purchTable =_args.record();
new MenuFunction(MenuItemDisplayStr(POPopUpTmpForm),MenuItemType::Display).run(_args);
}
To open with filtered selection from Source Form to Destination form
You can use this code,
Args args = new Args();
FormRun formRun;
VendTable vendTable_filtered;
;
select vendTable_filtered where vendTable_filtered.AccountNum == "KRISHNA0001";
args.name(formstr(VendTable));
args.record(vendTable_filtered);
formRun = classfactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.detach();
Comments
Post a Comment