General X++ Development
How do I create a custom lookup using `SysTableLookup`?
How do I create a custom lookup using SysTableLookup?
1 answer
Write an answerBuild a query, pass it to SysTableLookup, then add the fields you want shown.
Query query = new Query();
QueryBuildDataSource qbds = query.addDataSource(tableNum(CustTable));
qbds.addRange(fieldNum(CustTable, Blocked))
.value(queryValue(CustVendorBlocked::No));
SysTableLookup lookup =
SysTableLookup::newParameters(tableNum(CustTable), _formControl);
lookup.parmQuery(query);
lookup.addLookupfield(fieldNum(CustTable, AccountNum));
lookup.addLookupfield(fieldNum(CustTable, NameAlias));
lookup.performFormLookup();This is the pattern I use when the lookup needs its own filtering or extra display columns.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer