Pass Args as record from onclick event handler to menu item D365fo [X++]

/// <summary>
///
/// </summary>
/// <param name=”sender”></param>
/// <param name=”e”></param>
[FormControlEventHandler(formControlStr(DocuView, Print), FormControlEventType::Clicked)]
public static void Print_OnClicked(FormControl sender, FormControlEventArgs e)
{
Args args = new Args() ;

DocuRef _DocuRef ;
FormRun _formRun = sender.formrun() as FormRun ;

FormDataSource _ds ;
_ds =sender.formRun().dataSource(1);
_DocuRef = _ds.cursor();

args.record(_DocuRef);
// calling menu item
new MenuFunction(identifierstr(DocuViewPrint), MenuItemType::Action).run(args);

}

Leave Comment

Your email address will not be published. Required fields are marked *