In this Power Automate tutorial, we will discuss, how to use contains filter query in Power Automate Get items flow action. We will also see, how to fix the error, Power Automate SharePoint Get items filter query contains is not valid. The error also looks like, Action ‘Get_items’ failed in Power Automate flow or Microsoft flow.
The expression Title contains is not valid. Creating query failed in Power Automate
Recently, I got a requirement to move items from a SharePoint list to another list based on a filter condition using Power Automate. It should move the items whose title contains a specified string else it should not move the item.
Here we have two SharePoint lists i.e. DemaoPostgreSQL (the Source list) and another one is PostgreSQLTask(the destination list). It will move the items from one list to another if the title field contains a specific string i.e. Postgresql.
So we had used the ODATA filter expression in Power Automate Get_items filter query to get the filtered item that contains Postgresql:
Title contains 'Postgresql'
But when we ran the flow, we got the error details like below:
Action ‘Get_items’ failed
The expression “Title contains ‘Postgresql'” is not valid. Creating query failed.
After some research, we got to know that the Get_items does not support Contains in the filter query, so it shows the expression is not valid.
So to fix the error, follow the below steps.
How to use contains in Get items filter query in Power Automate
Since we can not use the Contains option in the Get items filter query in Power Automate, we will get all the items from the SharePoint list and then we will add a filter in a condition flow action.
The idea here is to use the filter based on the Title column inside the condition.
For this, here we will use a condition action after the Get_items that will filter the item that contains ‘postgreSQL’ on the title field.
In condition, we will use the Title from the Get-items action. Also, we will use the OR operator to search different formats of the string i.e. PostgreSQL / Postgresql / PostgreSQL.
Like Title contains PostgreSQL etc. Check the condition below:
If the condition will satisfy then it will create the filter items in the destination list and delete that item from the source list. So we will add an action inside the If yes section:
This is how the final flow looks like:
Now we will test this flow to see how it works. For this, in the Source list, we have inserted some data like:
After running the flow, we can see the specified items got moved to the destination list i.e. PostgreSQLTask
Also, these selected items got deleted from the source list:
You may like the following Power Automate tutorials:
- Power Automate save email attachment to SharePoint
- Power Automate If expression with examples
- Power Automate vs UiPath
- Power Automate conversion of string
- Power Automate Number Format
- Power Automate Initialize Variable
- Power Automate convert time zone
This is how we can fix the error when the action ‘Get_items’ ODATA filter contains is invalid in Power Automate. This is how to use the contains option in Power automate Get items filter query.
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com