web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :

ItemId Lookup for an Unbounded Control in D365FO

dasdasd Profile Picture dasdasd 841

 In D365FO, you can create an ItemId lookup for an unbounded control using SysTableLookup without requiring any datasource binding.

The key is to pass the control (sender) directly to SysTableLookup::newParameters() and define the required lookup fields and query.

[FormControlEventHandler(formControlStr(PurchCreateFromSalesOrder, MarkupItemId), 
FormControlEventType::Lookup)] public static void MarkupItemId_OnLookup(FormControl sender, FormControlEventArgs e) { SysTableLookup sysTableLookup; Query query; QueryBuildDataSource qbds; sysTableLookup = SysTableLookup::newParameters(tableNum(InventTable), sender); sysTableLookup.addLookupfield(fieldNum(InventTable, ItemId)); sysTableLookup.addLookupfield(fieldNum(InventTable, NameAlias)); query = new Query(); qbds = query.addDataSource(tableNum(InventTable)); // Optional filter // qbds.addRange(fieldNum(InventTable, ItemType)) // .value(queryValue(ItemType::Item)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); }

Key Point

For an unbounded control, pass sender to SysTableLookup::newParameters(). No datasource binding is required.


This was originally posted here.

Comments

*This post is locked for comments