AX / D365FO – How to Call table Display method in Custom lookup – X++

In this simple example I’ll show how add a Table display method as a field of a custom lookup field

public void dialogCustVendRel_lookup(FormStringControl _control)
   Query                   query = new Query();
   QueryBuildDataSource    queryBuildDataSource;
   SysTableLookup          sysTableLookup;

   sysTableLookup = SysTableLookup::newParameters(tableNum(VendTable), _control);

   sysTableLookup.addLookupField(fieldNum(VendTable, AccountNum));

   sysTableLookup.addLookupMethod(tableMethodStr(VendTable, name));

   // Setup query
   queryBuildDataSource = query.addDataSource(tableNum(VendTable));
   // Perform lookup

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s