As we known, in AR/AP module->Purch/Sales Line Button->Inventory->Onhand button.
in Invent module->On hand button
When you click this button, you can get quantity information on hand of an item.
When you created a new form included one or more item. How can i implement the function above? or How can get its quantity on hand?
Try it:
MenuFunction mf = new MenuFunction(menuItemDisplayStr(InventOnHandItem), MenuItemType::Display);
Args args = new Args();
super();
args.caller(element);
args.record(InventTable::find(Table1.Field1)); //Your datesource.itemid
mf.run(args);