Hi, I have a question related to Dynamics 365 Finance and Operations.
However, when I checked, there is
no LookupReference() method for the created reference group control in the MainAccount form code. Hence, I try to use the Chain of Command to extend the MainAccount form code and add a public Common lookupReference() method, but it does not work. The code that I wrote is as follows:
[ExtensionOf(formStr(MainAccount))]
final class MainAccount_Classification_Extension
{
[Control(/ReferenceGroup/)]
class EcoResCategory
{
public Common lookupReference(FormReferenceControl _formReferenceControl)
{
SysReferenceTableLookup sysReferenceTableLookup;
Query query;
QueryBuildDataSource qbds;
sysReferenceTableLookup = SysReferenceTableLookup::newParameters(tableNum(EcoResCategory), _formReferenceControl);
sysReferenceTableLookup.addLookupfield(fieldNum(EcoResCategory,Code));
sysReferenceTableLookup.addLookupfield(fieldNum(EcoResCategory,Name));
query = new Query();
qbds = query.addDataSource(tableNum(EcoResCategory));
qbds.addQueryFilter(qbds, fieldStr(EcoResCategory,Code)).value('!//');
sysReferenceTableLookup.parmQuery(query);
return sysReferenceTableLookup.performFormLookup();
}
}
}
May I know how to resolve it so I can have the reference group field display the records that match my condition only?