Forum Discussion
New to MS Flow : Having Trouble With a Simple Automation Task
Hi, Latisha Williamson...
I think maybe the key is that now() has a time portion as well, so it will likely never exactly equal your "Plan Date" - if Plan Date is a SharePoint date field set to "Date Only", the time will always be midnight in UTC time.
I got this to work by using the StartOfDay function in Flow, to force both now() and the SharePoint date to be at time 00:00. I used the Initialize Variable action near the beginning of the Flow, to create a variable called 30Days with a formula of:
addDays(startOfDay(utcNow()),30)
which takes midnight today and adds 30 days.
Then within the Apply to Each section, I added a Compose action before the comparison condition, to zero the time portion of the SharePoint field (otherwise it would be midnight in UTC), and concatenate a Z to the end, so we can compare like text strings (the variable result is in the ISO 8601 format):
"@concat(StartOfDay(item()['StartDate']),'Z')"
I couldn't find a way to enter this Compose formula using the Dynamic/Expression UI, so I had to type it manually, hence the at sign and the quotes around it.
And then in my Condition, I compared the Output of the Compose, to the 30Days variable, and that worked.
I'm not sure this is the most elegant way to do it, but I hope it may help you, without needing to have your SharePoint folks modify the list.
Sandy