Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Getting extra fields in multiselect lookup grid

(2) ShareShare
ReportReport
Posted on by 1,678
 In my custom lookup grid i am getting more fields i need only two fileds company and name , but it is showing other fields in grid also how can i limit it to only fields required ,
when i select data from company info it get only two fields but when i apply filter to the lookup it get more than two fields , how can i make them show only fields required .
here is the gird .
 
  public void lookup()
        {
            super();
            
            OMUserRoleOrganization omOrg;
            boolean hasOrgAccess = false;

            // Check if the current user has any organization access records
            select firstonly RecId from omOrg
        where omOrg.User == curUserId();

            hasOrgAccess = (omOrg.RecId != 0);

            Query query = new Query();
            QueryBuildDataSource qbdsCompany = query.addDataSource(tablenum(CompanyInfo));
    
            qbdsCompany.addSelectionField(fieldNum(CompanyInfo, DataArea));
            qbdsCompany.addSelectionField(fieldNum(CompanyInfo, Name));

            if (hasOrgAccess)
            {
                QueryBuildDataSource qbdsOrg = qbdsCompany.addDataSource(tablenum(OMUserRoleOrganization));
                qbdsOrg.relations(false);
                qbdsOrg.joinMode(JoinMode::InnerJoin);
                qbdsOrg.addLink(
            fieldnum(OMUserRoleOrganization, omInternalOrganization),
            fieldnum(CompanyInfo, RecId));
        
                qbdsOrg.addRange(fieldnum(OMUserRoleOrganization, User)).value(queryValue(curUserId()));
            }

            msLookupCtrl = SysLookupMultiSelectCtrl::constructWithQuery(this.formRun(), this, query);
            msLookupCtrl.set(msLookupCtrl.getSelectedFieldValues());

        }
 
  • Dineshkarlekar Profile Picture
    1,678 on at
    Getting extra fields in multiselect lookup grid
     
    the string is not bound to datasource , it is simple string field i have override the lookup method on it .
    the from data source is 
    OMUserRoleOrganization
  • Layan Jwei Profile Picture
    7,898 Super User 2025 Season 1 on at
    Getting extra fields in multiselect lookup grid
    Hi Dinesh,
     
    So you created a new form with pattern dialog?
    What are the datasources (please take a screenshot)
     
    And this form string control, is it bound to a datasource?
  • Layan Jwei Profile Picture
    7,898 Super User 2025 Season 1 on at
    Getting extra fields in multiselect lookup grid
    Hi Dinesh,
     
    So u created a new form of type dialog?
    What are the datasources?
    Please take a screenshot 
  • Dineshkarlekar Profile Picture
    1,678 on at
    Getting extra fields in multiselect lookup grid
    thanks for reply , 
    I am using this lookup code on from string control , it is custom dialogue form.
     
    Thanks, 
    Regards ,
     
    Dinesh
  • André Arnaud de Calavon Profile Picture
    296,017 Super User 2025 Season 1 on at
    Getting extra fields in multiselect lookup grid
    Hi Dinesh,
     
    Where exactly are you using this coding? Is it on a new table or is it an extension to override an existing lookup? If so, have you verified if the current lookup with all fields is a standard lookup?
  • Dineshkarlekar Profile Picture
    1,678 on at
    Getting extra fields in multiselect lookup grid
     
    thanks for reply,
    when i am getting the data from table inside if condition it gets all this fields in lookup, but i only want it to show company and name , and out of if conditio it is showing only two name ie company and name  which is fine the grid in below image is coming  from omuserorgainsation table within if condition i want only two fields Company and name.
    i want to show grid this much only 
    not this much.
  • Layan Jwei Profile Picture
    7,898 Super User 2025 Season 1 on at
    Getting extra fields in multiselect lookup grid
    Hi
     
    What do you mean by when when you select data from company info, you only get two fields? But when u filter you get more?

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 565

#2
Martin Dráb Profile Picture

Martin Dráb 536 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 402 Super User 2025 Season 1

Product updates

Dynamics 365 release plans