General X++ Development

How do I create a lookup in X++?

Asked by Sunny Vasty· Aug 13, 2026· 1 answers

How do I create a lookup in X++?

SSunny Vasty75 reputation · answered Aug 13, 2026

For a simple custom table lookup, use SysTableLookup.

X++
SysTableLookup sysTableLookup =
    SysTableLookup::newParameters(tableNum(CustTable), _formControl);

sysTableLookup.addLookupfield(fieldNum(CustTable, AccountNum));
sysTableLookup.addLookupfield(fieldNum(CustTable, NameAlias));

sysTableLookup.performFormLookup();

Before building a custom lookup, check whether the EDT/table relation already gives you the lookup you need. A custom lookup is useful when the standard relation is not enough, not as the default for every field.