I want to have a flow that runs every morning that checks a Sharepoint list of demo items. If an item is checked out (defined by a yes/no column named 'Checked Out') the flow checks the expected return date (Date/Time column formatted as date only, named 'Expected Return Date'). If the current date is 'Expected Return Date' or later, the flow sends an email to an admin with whatever item is meant to be returned.
I have the recurrence set up, and am grabbing the correct list. I tried the filter there to limit to only checked out items, but I don't think i used it right. Currently it grabs all items. Then there is an Apply to Each using the value for the list of items.
The evaluation condition is tripping me up here. I'm not sure how to get the Yes/no column to evaluate to true if it is checked out. Currently I have an and statement with two conditions. First condition gets the 'Checked Out' value, and is formatted to convert the value to true or false:
if(equals(item()['Checked Out'],'Yes'),true, false)
which is then compared by 'is equal to' true. This seems to be the main issue, so maybe this is the wrong way to check.
The second condition formats the date of the 'Expected Return Date' like so:
formatDateTime(item()['Expected Return Date'],'dd-mm-yyyy')
and checks if it is greater than or equal to today:
formatDateTime(utcNow(),'dd-mm-yyyy')
I've had "successful" runs but am not sending an email, but now it breaks at the Yes/No column check.
Check yes no column like below... Convert it to bool and check if true or false....
Hi @TaylorW
If your SharePoint column is boolean data type then you don't need to convert to boolean. Next your current date format expression is wrong. I can see you are using dd-mm-yyyy format. You need to use yyyy-MM-dd for comparisons.
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogHello @TaylorW ,
you can filter the items directly in the 'Get items' action using the 'Filter Query' to get only the items that fit the filter. You'll need to know the internal names for 'Expected Return Date' and 'Checked out' and then you can build a composed filter query.
(CheckedOut eq 1) and (ExpectedReturnDate ge 'utcNow('yyyy-MM-dd')')
Notes:
CheckedOut and ExpectedReturnDate must be the columns internal names
1 represents the Yes value in Yes/No SharePoint column
utcNow('yyyy-MM-dd') is an expression to take today's date for the comparison, the whole expression must be in apostrophes
And are you sure you want to use greater than or equal on the return date? Greater = items with return date in the future, shouldn't you use less than or equal to get items with return date today or in the past?