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, ...
Unanswered

Getting extra fields in multiselect lookup grid

(2) ShareShare
ReportReport
Posted on by 1,836
 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());

        }
 
I have the same question (0)
  • Layan Jwei Profile Picture
    8,118 Super User 2025 Season 2 on at
    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?
  • Dineshkarlekar Profile Picture
    1,836 on at
     
    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.
  • André Arnaud de Calavon Profile Picture
    301,183 Super User 2025 Season 2 on at
    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,836 on at
    thanks for reply , 
    I am using this lookup code on from string control , it is custom dialogue form.
     
    Thanks, 
    Regards ,
     
    Dinesh
  • Layan Jwei Profile Picture
    8,118 Super User 2025 Season 2 on at
    Hi Dinesh,
     
    So u created a new form of type dialog?
    What are the datasources?
    Please take a screenshot 
  • Layan Jwei Profile Picture
    8,118 Super User 2025 Season 2 on at
    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?
  • Dineshkarlekar Profile Picture
    1,836 on at
     
    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

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
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 420 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 241 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans