Check the Event handler Code,
[FormControlEventHandler(formControlStr(BankParameters, JournalName_VendPaymJourName), FormControlEventType::Lookup)]
public static void JournalName_VendPaymJourName_OnLookup(FormControl sender, FormControlEventArgs e)
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(LedgerJournalName), sender);
sysTableLookup.addLookupField(fieldNum(LedgerJournalName, JournalName));
sysTableLookup.addLookupField(fieldNum(LedgerJournalName, Name));
queryBuildDataSource = query.addDataSource(tableNum(LedgerJournalName));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Enjoy .👍