web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Filter DialogField lookup values

(0) ShareShare
ReportReport
Posted on by 605

Hi,

I'm trying to add a filter to the lookup of a dialog field (ItemId) based on a specific criteria.

While searching I found something talking about overriding the lookupReference of the dialogfield control which I couldn't find how to do it.

what I did is the following:

1. Created a method for filtering the lookup

private Common lookupSupplyItem(FormReferenceControl _ctrl)
{
SysReferenceTableLookup tableLookup = SysReferenceTableLookup::newParameters(tableNum(InventTable), _ctrl);
Query query = new Query();
QueryBuildDataSource qbds = query.addDataSource(tableNum(InventTable));
qbds.addRange(fieldNum(InventTable,ItemId)).value("hrco2.4*");

tableLookup.parmQuery(query);
tableLookup.addLookupfield(fieldNum(InventTable, ItemId));

return tableLookup.performFormLookup();
}

2. Tried to override the lookup method

dialog dialog;

dialogField dialogField;

dialog = new Dialog("Select Supply Item");
dialogField = dialog.addField(extendedTypeStr(ItemId));

dialogField.registerOverrideMethod(methodstr(FormReferenceControl, lookupReference),

methodstr(mxsCuttingWorkbench_Extension, lookupSupplyItem),
this);


Is there anything I'm missing? as the system is not doing the override and lookup is showing all records and lookup fields (tried to debug the filter method but the system didn't reach it)

Thank you for your support

- Sorry for posting in the wrong section - This should be in D365 for Finance and Operations, Enterprise edition

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Ammar Abbasi Profile Picture
    55 on at

    Hi Ihab,

    Please check if the following code satisfies your scenerio, add this code to you lookup method:

    Query                   query = new Query();
                QueryBuildDataSource    queryBuildDataSource;
                boolean                 searchCriteria = true;
        
                SysTableLookup  sysTableLookup = sysTableLookup::newParameters(tableNum(InventTable), this);
    
        
                queryBuildDataSource = query.addDataSource(tableNum(InventTable));
    
                if (searchCriteria) //Your search criteria goes here
                {
                    queryBuildDataSource.addRange(fieldNum(InventTable, ItemId)).value("1000");
                }
    
                sysTableLookup.addLookupfield(fieldNum(InventTable, ItemId), true);
        
                sysTableLookup.addLookupMethod(identifierStr(itemName));
        
                sysTableLookup.parmQuery(query);
        
                sysTableLookup.performFormLookup();
    Hope that helps!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
imran ul haq Profile Picture

imran ul haq 8

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 4 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans