Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

The query may contain too many parameters. Please reduce the number of parameters and try again??

(0) ShareShare
ReportReport
Posted on by
Hello Everyone,
 
I want to add XDS security and i have enable the security on multiple users but unfortunately on few users i am facing this (PIC 1) kind of error with specific warehouse.
I have use this code on form data source level for filter the data as per the condition with i have mentioned in (PIC 2).
 
NOTE:
When i delete the specific warehouse on the user list form then everything will work fine. 
 
 
 
Pic 1:
 
 
 
 
Pic 2:
 
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,593 Super User 2024 Season 1 on at
    The query may contain too many parameters. Please reduce the number of parameters and try again??
    Agreeing with Martin, here 2 whiles are not necessary. You can do a join so that a single while is enough like below.
    container c;
    
    while select <requiredFields> from wareHouseUserSetup
    where wareHouseUserSetup.userId = curUserid()
    join RecId from inventTransferTableLocal
    where <give relation>
    {
        c+= queryValue(inventTransferTableLocal.RecId);
    }
    
    //Add line 24 of your code and in the value put,con2str(c)
    So just give a relation as said in above code so that you will get a single while and select only fields you require. Then make all the recids available to a container and from that container, the range can be added. 
  • Martin Dráb Profile Picture
    Martin Dráb 230,994 Most Valuable Professional on at
    The query may contain too many parameters. Please reduce the number of parameters and try again??
    Even if your code worked, using it would be a bad idea, because it's very inefficient.
     
    You load all fields of all transfer orders (for the given warehouse) and then filter transfer orders again by RecIds of those you found. Not only you don't need to fetch all other fields, but you also don't need the extra query at all. You can filter the query data source by InventLocationId directly. Just note that you'll need to use an expression there; just setting range values of InventLocationIdForm and InventLocationIdTo wouldn't result in the right query.
     
    By the way, I moved your thread from Dynamics 365 General forum, because it's clearly about F&O and not Dynamics 365 in general (which covers also products like Business Central or Sales).

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,234 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,994 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans