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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to filter the value displayed in the reference group

(0) ShareShare
ReportReport
Posted on by 147
Hi, I have a question related to Dynamics 365 Finance and Operations.
 
I created a reference group control in my MainAccount form which will look up to the Category Hierarchies (EcoResCategory) table. In the reference group lookup field, I need it to display only the record where the EcoResCategory.CategoryHierarchy = '68719480517'.
 
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?
 
I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at
    What do you mean by "it does not work"?
     
    (Moved from Dynamics AX forum.)
  • Yue Zhen Profile Picture
    147 on at
    Hi Sir Martin,
     
    It means when debugging, the code is hit but I cannot trigger it. The reference group lookup options is not filter based on the condition I wrote in the lookupReference() method.
  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at
  • Suggested answer
    Nisha Soni 2709 Profile Picture
    on at
    you need to filter a field which refer to your reference field because reference field cannot be filter directly, your reference field should filter automatically.
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    You missed adding a range in your query.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans