cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Patron
Post Patron

Delay flow until the start of business hours

I have a simple flow which triggers when an item is created and modified in a SharePoint list. The flow posts a notification in teams personal chat when an item is created or modified. If flow triggers between 6PM today and 8AM tomorrow, I would like to delay the flow and trigger any time after 8AM. Can someone help me how to calculate the difference hours and delay the flow accordingly?

Thanks a lot in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @RameshMukka,

 

My mistake. It's an old screenshot, thank you for note.

Yes, you should check your local time falls between 00:00 and 07:59.

Correct screenshot as below:

Screenshot 2021-01-14 153143.jpg

 

convertTimeZone(triggerOutputs()?['body/Modified'], 'UTC', 'Pacific Standard Time','yyyy-MM-ddTHH:mm:ssZ')
formatDateTime(variables('LocalTime'),'HH:mm:ss')

 

Screenshot 2021-01-14 153251.jpg

Compose:

addDays(variables('LocalTime'),1,'yyyy-MM-ddT08:00:00Z')

 Compose2:

convertToUtc(formatDateTime(outputs('Compose'),'yyyy-MM-ddTHH:mm:ss'),'Pacific Standard Time')

Delay Until 2:

convertToUtc(formatDateTime(variables('LocalTime'),'yyyy-MM-ddT08:mm:ss'),'Pacific Standard Time')

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support
Community Support

Hi @RameshMukka,

 

You could following steps to approach that:

1. Since the item modified time is UTC time, so you should use the convertTimeZone() function convert the utc time to your local time.

 

convertTimeZone(triggerOutputs()?['body/Modified'], 'UTC', 'Pacific Standard Time','yyyy-MM-ddTHH:mm:ss')

 

2. Use Condition action check if the time greater than 18:00 and less than 24:00:00, if yes, add 1 day, then convert it to the UTC time, the time set to 8 o'clock, and append it to the Delay Until action;

 

addDays(variables('LocalTime'),1,'yyyy-MM-ddT08:00:00Z')
convertToUtc(formatDateTime(outputs('Compose'),'yyyy-MM-ddTHH:mm:ss'),'Pacific Standard Time','yyyy-MM-ddTHH:MM:ssZ')

 

3. if no, convert the time to 8 o'clock, and append the time to Delay Until:

 

convertToUtc(formatDateTime(variables('LocalTime'),'yyyy-MM-ddT08:mm:ss'),'Pacific Standard Time','yyyy-MM-ddTHH:MM:ssZ')

 

 

Screenshot 2021-01-14 153143.jpg

 

Screenshot 2021-01-14 153251.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-litu-msft Thanks a lot for this details. Time zone conversions are a bit confusion for me. I have a question here. Why didn't you choose 'LocalTime' in your condition? Shouldn't I check my local time falls between 00:00 and 07:59? I am confused as you used 'Modified'. Can you clarify?

Community Support
Community Support

Hi @RameshMukka,

 

My mistake. It's an old screenshot, thank you for note.

Yes, you should check your local time falls between 00:00 and 07:59.

Correct screenshot as below:

Screenshot 2021-01-14 153143.jpg

 

convertTimeZone(triggerOutputs()?['body/Modified'], 'UTC', 'Pacific Standard Time','yyyy-MM-ddTHH:mm:ssZ')
formatDateTime(variables('LocalTime'),'HH:mm:ss')

 

Screenshot 2021-01-14 153251.jpg

Compose:

addDays(variables('LocalTime'),1,'yyyy-MM-ddT08:00:00Z')

 Compose2:

convertToUtc(formatDateTime(outputs('Compose'),'yyyy-MM-ddTHH:mm:ss'),'Pacific Standard Time')

Delay Until 2:

convertToUtc(formatDateTime(variables('LocalTime'),'yyyy-MM-ddT08:mm:ss'),'Pacific Standard Time')

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (12,404)