I am trying to get the supplementary item form to pop up when the ItemId field in a Sales Order (and again on the Purchase Order) is modified.
My current code listed below, opens the form but it doesn’t seem to bring over the Item with it. The form is blank even though there are supp items attached to the item I am using for testing. However, if I hit the Supplementary Item menu item under the Sales Line fast tab in the Sales Order Line > Calculate Supplementary Item menu then it shows all the items I would expect to be there.
Why isn’t the code able to grab the item that I input on the sales line?
[FormControlEventHandler(formControlStr(SalesTable, SalesLine_ItemId), FormControlEventType::Modified)]
public static void SalesLine_ItemId_OnModified(FormControl sender, FormControlEventArgs e)
{
FormRun formRun = sender.formRun() as FormRun;
Args args = new Args();
SalesLine salesLine;
SalesTable salesTable;
FormDataSource salesTable_ds = formRun.dataSource(formDataSourceStr(SalesTable, SalesTable)) as FormDataSource;
salesTable = salesTable_ds.cursor();
//Open Calculate supplimentary items form.
args.record(salesTable);
args.caller(formRun);
new MenuFunction(menuItemActionStr(SuppItemCalc_Sales), MenuItemType::Action).run(args);
}