Could someone explain how I can do a daily check of a SharePoint list and run a flow depending on a date entry.
I need the flow to check for records that have a null value in a column (record closed value) and then check it's related date column entry. If the date today is 3 days greater than that date, then fire the flow.
1.- Recurrence trigger
2.- SP 'Get items' action block. I am assuming you are talking about a SP list and not a SP library
In order to filter the contents of the list, there are different techniques:
-An 'Apply to each' with a Condition action block inside, taking 'Get items' output as 'Apply to Each' input
-A 'Filter Array' action block, then an Apply to Each taking Filter Array output as 'Apply to Each' input
-Filter ODATA query in the Get Items action block, then an Apply to Each taking 'Get items' output as 'Apply to Each' input
ILet's assume we work with the filter expression, and we want to search items with Column A null and column B 3 days less than today. Assuming both are called 'ColumnA' and 'ColumnB', a possible approach is the following Filter Array expression:
@And(less(item()?['ColumnB'], addDays(utcnow(), -3)),not(equals(coalesce(item()?['ColumnA'],'null'),'null')))
IN the following screenshot you will see the secuence of actions after trigger Recurrence, please not I am not using 'Get items' but 'Get files (properties only)' and the expression shown in the screenshot is not the one you need, but the following steps should be the same for you
Hope this helps
Attaches is my list structure.
If the status is blank and it is 3 days since the DateAdded date, then an email should be sent.
The check needs to be done daily.
If you follow my suggestion, the expression for your SP List would probably be:
@And(less(item()?['DateAdded'], addDays(utcnow(), -3)),not(equals(coalesce(item()?['Status'],'null'),'null')))
I would first implement the flow including yourself as destination of the email ('Send an email v2' shall be placed inside the Apply To each'), if it works as you expected (i.e. the List Elements reported are the ones you want to filter) then replace your email address and add the real destination. I am assuming you want to send one email per List element matching your conditions
Hope this helps
Finally got around to testing it.
With the filter array I got
@And(less(item()?['Date Received'],addDays(utcnow(), -3)),not(equals(coalesce(item()?['Status'],'null'),'null')))
InvalidTemplate. The execution of template action 'Filter_array' failed: The evaluation of 'query' action 'where' expression '@And(less(item()?['Date Received'],addDays(utcnow(), -3)),not(equals(coalesce(item()?['Status'],'null'),'null')))' failed: 'The template language function 'less' expects two parameter of matching types. The function was invoked with values of type 'Null' and 'String' that do not match.'.
Features releasing from October 2020 through March 2021
We are excited to announce the launch of Power Virtual Agents Community. Check it out now!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!