Hi,

In my previous post I implemented UIBuilder class with the help of postBuild method, now will implement postRun method with the business requirement of showing only items of type Item in the lookup by overriding the lookup method of dialog field ItemId.

Class: CG_DataUIBuilder and Method: postRun

public void postRun()
{
    super();
    
    dialogFieldItemId.registerOverrideMethod(methodstr(FormStringControl, lookup),
                                             methodstr(CG_DataUIBuilder, itemLookup),
                                             this);
}

Class: CG_DataUIBuilder and Method: itemLookup

public void itemLookup(FormStringControl _control)
{
    Query                   query;
    QueryBuildDataSource    qbdsInventTable;
    QueryBuildRange         qbrItemType;
    SysTableLookup          sysTableLookup = SysTableLookup::newParameters(tableNum(InventTable), _control);
    
    query = new Query();
    qbdsInventTable = query.addDataSource(tableNum(InventTable));
    qbrItemType = SysQuery::findOrCreateRange(qbdsInventTable, fieldNum(InventTable, ItemType));
    qbrItemType.value(queryValue(ItemType::Item));
    
    sysTableLookup.addLookupfield(fieldNum(InventTable, ItemId));
    sysTableLookup.addLookupfield(fieldNum(InventTable, ItemType));
    sysTableLookup.addLookupfield(fieldNum(InventTable, ItemBuyerGroupId));
    
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

Lookup On Dialog:
   

Regards,

Chaitanya Golla