cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RKushner
Advocate IV
Advocate IV

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
v-yamao-msft
Community Support
Community Support

 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
v-yamao-msft
Community Support
Community Support

 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

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

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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (2,959)