Hi All,
in this post, we'll check how to call the Display menu Item or Form from the back end.
Step 1: Add the respective button in the existing form or new form, go to events, and copy the clicked event handler.
Sample code look alike
[FormControlEventHandler(formControlStr(SalesTable, Complete), FormControlEventType::Clicked)]
public static void Complete_OnClicked(FormControl sender, FormControlEventArgs e)
{
// your Code
}
now copy-paste or rewrite the below code according to your requirements.
[FormControlEventHandler(formControlStr(SalesTable, Complete), FormControlEventType::Clicked)]
public static void Complete_OnClicked(FormControl sender, FormControlEventArgs e)
{
FormRun form = sender.formRun();
FormDataSource salesTable_ds = form.dataSource(formDataSourceStr(SalesTable, SalesTable)) as FormDataSource;
SalesTable salesTable = salesTable_ds.cursor();
Args args;
MenuFunction menuFunction;
info(strFmt("%1",SalesStatus::None));
if(salesTable.SalesStatus == SalesStatus::None)
{
args.record(salesTable); // to send whole table as parameter
args.caller(sender);
menuFunction = new MenuFunction(menuItemDisplayStr(BER_CreateQuotationFromSalesOrder), MenuItemType::Display);
menuFunction.run(args);
}
else
{
throw Error(strfmt('[LabelID]',salesTable.SalesStatus));
}
}
Thanks
Keep Daxing :)
No comments:
Post a Comment