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)

Report
All responses (
Answers (