Create new event handler class:
class EZDNRParametersFormEventHandler
{
[FormDataSourceEventHandler(formDataSourceStr(DNRParameters, RORParameters), FormDataSourceEventType::Initialized)]
public static void RORParameters_OnInitialized(FormDataSource _sender, FormDataSourceEventArgs _e)
{
_sender.object(fieldNum(RORParameters, EZExcessHoursCategoryId)).registerOverrideMethod(
methodStr(FormDataObject, lookup),
methodStr(EZDNRParametersFormEventHandler, excessHoursCategoryIdLookup),
new EZDNRParametersFormEventHandler());
}
public void excessHoursCategoryIdLookup(FormStringControl _control)
{
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(ProjCategory), _control);
sysTableLookup.addLookupfield(fieldNum(ProjCategory, CategoryId), true);
sysTableLookup.addLookupfield(fieldNum(ProjCategory, Name));
Query query = new Query();
query.addDataSource(tableNum(ProjCategory))
.addRange(fieldNum(ProjCategory, CategoryType))
.value(queryValue(ProjCategoryType::Hour));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
}