cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
RKushner
Level: Powered On

SharePoint/Flow: Unable to use a Filter Query in a Get items action

I have tried to filter by a date field and by a choice field, but they both result in an invalid expression error.

 

For the date field, I write: ExpiryDate le addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd')

 

and I get: The expression "ExpiryDate le 2018-06-22" is not valid. clientRequestId: 32c616f1-365e-4b8d-b0e7-1913c661f5b5 serviceRequestId: f766709e-8023-5000-d589-a40ee4e3f486

 

which shows that addDays(utcNow... is working. And ExpiryDate is a date field set to Date Only.

 

For filtering on a choice, I write: AccountStatus = 'Active'

 

and the error is: The expression "AccountStatus = 'Active'" is not valid. clientRequestId: 86b5f33a-6e81-4529-9de3-e74b57dc951f serviceRequestId: 4168709e-90db-5000-e4ca-2f66fd17f8b8

 

In the end, I need to have a compound conditions that ANDs these two together. But first, I would like to have them work separately. For now, I have almost 1,000 rows in my list, but it will double before too long and double again before it is mature.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: SharePoint/Flow: Unable to use a Filter Query in a Get items action

 Hi @RKushner,

 

For the date filed, I assume that you didn’t add a single quote around the function adddays in the Filter Query filed. Please configure the code under Expression tab then add a single quote around the code. Please take the following screenshot for a reference:

1.PNG

 

 

For the AccountChoice field, the code used in the Filter Query filed should be

AccountChoice eq 'Inactive'

 

And if you want to combine the two code together, please use the following code:

ExpiryDate le addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd') and AccountChoice eq 'Inactive'

2.PNG

 

This doc about Filter expressions in Odata URLs could be helpful for you:

https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)

 

 

 

Best regards,

Mabel Mao

 

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: SharePoint/Flow: Unable to use a Filter Query in a Get items action

 Hi @RKushner,

 

For the date filed, I assume that you didn’t add a single quote around the function adddays in the Filter Query filed. Please configure the code under Expression tab then add a single quote around the code. Please take the following screenshot for a reference:

1.PNG

 

 

For the AccountChoice field, the code used in the Filter Query filed should be

AccountChoice eq 'Inactive'

 

And if you want to combine the two code together, please use the following code:

ExpiryDate le addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd') and AccountChoice eq 'Inactive'

2.PNG

 

This doc about Filter expressions in Odata URLs could be helpful for you:

https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)

 

 

 

Best regards,

Mabel Mao

 

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

RKushner
Level: Powered On

Re: SharePoint/Flow: Unable to use a Filter Query in a Get items action

For the date field, that works!!! 

 

But for the Account choice field, that is what I am already doing, and it doesn't work:

 

I write: AccountStatus = 'Active'

 

and the error is: The expression "AccountStatus = 'Active'" is not valid. clientRequestId: 86b5f33a-6e81-4529-9de3-e74b57dc951f serviceRequestId: 4168709e-90db-5000-e4ca-2f66fd17f8b8

 

I think that there is a special syntax for choice fields in conditions...

RKushner
Level: Powered On

Re: SharePoint/Flow: Unable to use a Filter Query in a Get items action

I am confused because even though AccountStatus = 'Active' doesn't work, putting the two conditions together (like you said, ExpiryDate le 'addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd')' and AccountChoice eq 'Inactive') does work!!!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 131 members 5,337 guests
Please welcome our newest community members: