Hello everyone,
I'm experiencing an issue with my Power Automate flow, and I could use some help. My flow is designed to send an email when a trigger occurs on SharePoint, but only during the hours of 9:00 AM to 4:00 PM (Eastern Standard Time). If the trigger happens outside this time range, the email should be delayed until 9:00 AM the next day.
Here's the setup:
- Get current time: Retrieves the current time in UTC.
- Convert time zone: Converts the current UTC time to Eastern Standard Time.
- Condition: Checks if the converted time is between 9:00 AM and 4:00 PM.
- If yes: Sends the email immediately.
- If no: Uses a "Compose" action to calculate the next 9:00 AM in EST and a "Delay until" action to delay the email until then.
The issue I'm facing is that when I ran a test at 10:00 AM EST, the flow incorrectly evaluated the condition as false and went to the false branch, delaying the email instead of sending it immediately. Also, the "Delay Until" action has a lot of issues. I believe this all stems from my time zone issue, and I am not sure how to fix it.
Here are the expressions I'm using:
- Condition:
@and(
greaterOrEquals(formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Eastern Standard Time'), 'HH:mm'), '09:00'),
lessOrEquals(formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Eastern Standard Time'), 'HH:mm'), '16:00')
)
- Compose (for the false branch):
addHours(convertTimeZone(startOfDay(addDays(utcNow(), 1)), 'UTC', 'Eastern Standard Time'), 9)
Any insights or suggestions on what might be going wrong would be greatly appreciated!
Thank you!