Desired Behaviour
I'm wanting to run a recurrent flow daily, that gets items from a SharePoint List:
Submitted
What I've Tried
Initially, I tried to add this to the Filter query
in the Get items
action:
Status eq 'Submitted' and Created eq '@{addDays(utcNow(),-1,'yyyy-MM-dd')}'
It doesn't return any results, probably because the Created
column value is something like:
2023-08-17T05:07:46Z
Whereas, the output of the addDays()
expression is something like:
2023-08-17
Of course I've googled for phrases like:
power automate sharepoint list get items created yesterday
And it returns results like those below:
Strangely, the accepted answers are:
Created gt '@{addDays(utcNow(),-1,'yyyy-MM-dd')}'
Created ge '@{addDays(utcNow('yyyy-MM-dd'),-1,'yyyy-MM-dd')}'
Neither of these make sense to me, because they are both saying:
In both of these cases, that would also return entries from today as well (I only want entries that were created yesterday).
Question
What filter query do I need to use in the Get Items
action that equates to:
For Reference
I've created a bunch of time-related Compose
actions in the process of troubleshooting the issue.
They are pasted below for reference in case they help in figuring out a solution.
Compose - Example Created value:
2023-08-17T05:07:46Z
Compose - UTC now converted to Brisbane timezone:
@{convertTimeZone(utcNow(),'UTC','E. Australia Standard Time')}
Compose - UTC now converted to Brisbane timezone formatted:
@{formatDateTime(convertTimeZone(utcNow(), 'UTC', 'E. Australia Standard Time'), 'yyyy-MM-dd')}
Compose - UTC yesterday converted to Brisbane timezone formatted:
@{formatDateTime(convertTimeZone(addDays(utcNow(), -1), 'UTC', 'E. Australia Standard Time'), 'yyyy-MM-dd')}
Try using filter query in get items action like below:
Status eq 'Submitted' and Created ge datetime'@{concat(addDays(utcNow(),-1,'yyyy-MM-dd'),'T00:00:00Z')}' and Created lt datetime'@{concat(formatDateTime(utcNow(),'yyyy-MM-dd'),'T00:00:00Z')}'
Where Status and Created are the internal names of your SharePoint list columns. You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?
Reference: Filter Created in SP REST API