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

Clear lookup filter

(1) ShareShare
ReportReport
Posted on by 493
In the system I can use lookup like that (value,value,value)
 
 
how can I achieve the same in a form? because it always filters with the text value!
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi,
     
    You can use is one of filter on the field if you have multiple values and you want to filter it.
     

    Thanks,

    Waed Ayyad

    If this helped, please mark it as "Verified" for others facing the same issue

  • Suggested answer
    Layan Jwei Profile Picture
    8,122 Super User 2025 Season 2 on at
    Hi,

    In the first screenshot,  i think the filter is based on query.

    For the 2nd screenshot to achieve the same, then same as Waed suggested you can change "begins with" to "is one of"
    then paste value, value, value directly or add one by one

    Thanks,
    Layan Jweihan
    ​​​​​​​Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • AbdullahAhmed_ Profile Picture
    493 on at
    Thanks for the response but I mean how to do it in the code
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi,
     
    Can you give us more details? Do you want your form to be filtered on certain values each time you open the form? 
     

    Thanks,

    Waed Ayyad

    If this helped, please mark it as "Verified" for others facing the same issue

     
     
  • AbdullahAhmed_ Profile Picture
    493 on at
    I want the user when using lookup it shows all the warehouses. So, if he chooses (101011, ) and uses the lookup again it doesn't filter with the field text "101011,"
  • André Arnaud de Calavon Profile Picture
    301,210 Super User 2025 Season 2 on at
    Hi Abdullah,

    I'm not able to understand what exact coding you are using now for what exact purpose. Can you explain if you have custom coding created already? Can you also tell step by step what a user is currently doing and at what step you have a behavior that you want to change? Apologies for some additional questions, but I'm not able to understand what exactly is the current state and what type of answer you are looking for. 
  • AbdullahAhmed_ Profile Picture
    493 on at
    Thank you Andre... here's a breakdown of the user flow:
    He chooses a user group, a specific table, a specific field from a list and in the value field he'll find a lookup depending on the field he chose (InventLocationId in my example) the lookup will show all the warehouses, if he chose AccountNum, the lookup will show all customers, etc..
     
    The expected behavior is:
    He chooses a field (InventLocationId) and then choose a value from the drop down lookup list.
    If he wants to add another value he attaches a comma and use the lookup again and select another value like this (101011,121011).
     
    The problem is:
     When he chooses the first value and attach a comma (101011,) the lookup filters automatically with this text "101011,"
    I don't want the lookup to be filtered with the text automatically, although he can click on the filter and clear the filter value (101011,) and then the lookup will show all the values again, but I don't want the user to have to do this!
     
    Another problem is when he the value has the text "101011," and he chooses "121011" from the lookup, the whole text is being replaced with the new lookup value, so  (101011,) becomes (121011)
  • Verified answer
    Layan Jwei Profile Picture
    8,122 Super User 2025 Season 2 on at
    Hi Abdullah,
     
    If you want the user to select multi values from the lookup, then you should implement multi select lookup.
     
    Maybe look at this article to get an overview
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • AbdullahAhmed_ Profile Picture
    493 on at
    Thank you so much.. It solved my problems and gave me different kind of problems...
     
    I've 2 different lookup scenarios.. if the user chooses AccountNum field for VendTable, a lookup with all vendors show be shown for him to choose from..
    and if he chooses VendGroup field he'll get a lookup with vendor groups.
     
    The problem is:
    When he choose AccountNum as field and use Vendors lookup and then add another record and choose VendGroup as a field.. the lookup will not show vendor groups but rather show all vendors instead and vice versa. 
     
    So, it depends on the field he uses the lookup for first, if he chooses VendGroup then it'll show vendor groups always even if the field is AccountNum!

    In other words, it doesn't toggle lookup method more than once!

    Here's my code:
    This is a global variable among the class
      SysLookupMultiSelectCtrl    msctrl;
      
    and this is the code in the datasource field methods:
    [DataField]
    class Value 
    {
        public void lookup(FormControl _formControl, str _filterStr)
        {   
            FormStringControl       frmStringCtrl;
            frmStringCtrl = element.design().controlName(formControlStr(SetupForm,Grid_Value));
        
            if(SetupTable.Field == 'VendGroup')
                    {
                        Query  q    = new Query();
                        qbds        = q.addDataSource(tableNum(VendGroup));
                        qbds.addSelectionField(fieldNum(VendGroup, VendGroup));
                        qbds.addSelectionField(fieldNum(VendGroup, Name));
                        msctrl = SysLookupMultiSelectCtrl::constructWithQuery(_formControl.formRun(),frmStringCtrl,q);   
                    }
            if(SetupTable.Field == 'AccountNum' && SetupTable.TableOption == TableOption::VendTable)
                    {
                        Query  q = new Query();
                        qbds        = q.addDataSource(tableNum(VendTable));
                        qbds.addSelectionField(fieldNum(VendTable, AccountNum));
    
                        qbds_DirPtyTable = qbds.addDataSource(tableNum(DirPartyTable));
                        qbds.addSelectionField(fieldNum(DirPartyTable, Name));
                        qbds_DirPtyTable.relations(true);
                        msctrl = SysLookupMultiSelectCtrl::constructWithQuery(_formControl.formRun(),frmStringCtrl,q);
                    }
        }
    
    
        public void modified()
        {
            SetupTable.Value = con2Str(msctrl.getSelectedFieldValues(),',');
    
            super();
        }
    }
     
  • Layan Jwei Profile Picture
    8,122 Super User 2025 Season 2 on at
    Hi Abdullah,

    I'm glad ur original issue is fixed. Please don't forget to verify the answer that helped.
    ​​​​​​​
    Maybe it's better to create a new question for your 2nd issue. Also I don't think you shared with the us the correct code. For example, you are using the variable "qbds" but you didn't define it anywhere so how is it working with you?
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

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
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans