Hello Community!
I'm working with Power Automate, and I need to create a "Get Items" action that filters on a choice field. First, I capture the current items Choice selection in a variable:
Then I try to use that variable as a filter:
But unfortunately, I get errors like this:
The expression "Enterprise SharePoint (it/sp) eq Enterprise SharePoint (it/sp)" is not valid. Creating query failed.
When I look at this comparison, I think it's a match. Has anyone else seen and solved this problem? If you have, please share the way to solve it along with examples.
Thanks!
Tom
@tsmolskow You are missing single quotes around your variable. I also don't think using a variable is necessary in your case. Whenever you are using strings in the Filter Query field, you need to ensure you wrap your string in single quotes.
Hey A Creative Opinion,
Thank you for your advice, and I certainly will try out your trick with the Compose Action. Unfortunately, after adding the field name to my Query Filter, I still get an error message. Here is the query setting:
Here is the error:
The expression "field_3 eq Information Technology (it)" is not valid. Creating query failed.
I thought the parathesis might be the problem, so I tried this code in both a variable to hold the edited items value and the filter comparison value, but it still errors out.
replace(replace(replace(triggerBody()?['field_3']?['Value'],'(',''),')',''),'/','')
Any thoughts?
@tsmolskow Your filter query is incorrect. You need to include the internal column name of your Choice column. Keep in mind that the internal column name may not always match the column name displayed in your Sharepoint list. If you aren't sure how to get the Internal Column name, you can refer to this section of one of my YT Tutorials.
Not sure how to write a filter query? Check out this YT short.
If you have more than 100 items in your SP list, you will need to toggle on pagination and set a threshold. The Get Items action returns 100 items per call by default, if you want more items returned per call you'll need to toggle on pagination and set a threshold. The threshold max is 5000.
Additionally, whenever I use a Filter Query in a Get Items action, I always like to return the count of items returned in a Compose action. This is helpful when building a flow and can also be used to troubleshoot your flow.
Insert a Compose action. Add an Expression. Use the length() function.
Select the Dynamic content tab and insert the value dynamic content from the Get Items action into the length() function.
Run a test.
Its been a long time since I've done it and I don't have any sharepoint lists to test with but I "think" you need to put the field3.value dynamic content in 'single quotes'
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1