cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

URGENT - Automatically setting Planner Due Date to skip weekends

Hi, I have a functioning flow which creates a Planner task when an Outlook email is flagged.

This automatically populates the 'Start Date' to the date of when the email was received and the 'Due Date' to be 3 days from the 'Start Date'. 

However I need my flow to skip weekends if this falls on the 3 day period and go to the next working day. 

I have no idea how to do this - any help would be appreciated. 

 

Due Date Time Expression: 

addDays(outputs('Compose'),3,'yyyy-MM-dd')
 
milo1234_0-1622135780287.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
kaitogoto
Microsoft
Microsoft

@Anonymous  Thank you for your reply. Firstly, can you please provide what error was returned on Message 5 and for Message 4, I have provided the expressions I used in the "compose" actions on my initial reply. Secondly, I will clarify the logic I used to adjust the due dates: If you want tasks to be due within three working days, the span from start day to end day must "touch" four weekdays. This is why if three days after start day is Monday, Tuesday, Saturday or Sunday, the due date must be pushed further by two days (i.e. five days after start day) because it "touched" both Saturday and Sunday. This was the logic behind step 2 of my initial reply and same logic applies for step 3.
Please accept as the solution if solved, reply with copy of all error messages if not. All the best!

View solution in original post

6 REPLIES 6
kaitogoto
Microsoft
Microsoft

I suggest this:

Screenshot 2021-05-31 200122.png

1) Use the dayOfWeek(addDays(outputs('Compose'),3,'yyyy-MM-dd')) expression on the compose action (like you have mentioned). This will return 1, 2 and 3 if Due Date is on Monday, Tuesday and Wednesday etc.

2) Use the condition action to test if the date returned by step 1 is equal to 1, 2, 6 or 7. If yes, return Due Date as

dayOfWeek(addDays(outputs('Compose'),5,'yyyy-MM-dd')). If no, continue to Step 3.

3) Use the condition action to test if the date returned by step 1 is equal to 3. If yes, return Due Date as dayOfWeek(addDays(outputs('Compose'),4,'yyyy-MM-dd')). If no, return Due Date as what was returned by Step 1.

Anonymous
Not applicable

@kaitogoto thank you for this. Would this step of my flow go before the 'Create a task' as seen in my attachment. 

Anonymous
Not applicable

@kaitogoto can you also show what you have put within each 'Compose'. Thank you

Anonymous
Not applicable

I have done the following however the flow failed - please can you advise? 

 
milo1234_0-1622631853292.png

 

milo1234_1-1622631861446.png

 

milo1234_2-1622631868225.png

 

milo1234_3-1622631874600.png

 

Anonymous
Not applicable

1) dayOfWeek(addDays(outputs('Compose'),3,'yyyy-MM-dd')) is create a task and compose 2 is changed to 5, compose 3 is changed to 4, and compose 4 is changed to 3.

kaitogoto
Microsoft
Microsoft

@Anonymous  Thank you for your reply. Firstly, can you please provide what error was returned on Message 5 and for Message 4, I have provided the expressions I used in the "compose" actions on my initial reply. Secondly, I will clarify the logic I used to adjust the due dates: If you want tasks to be due within three working days, the span from start day to end day must "touch" four weekdays. This is why if three days after start day is Monday, Tuesday, Saturday or Sunday, the due date must be pushed further by two days (i.e. five days after start day) because it "touched" both Saturday and Sunday. This was the logic behind step 2 of my initial reply and same logic applies for step 3.
Please accept as the solution if solved, reply with copy of all error messages if not. All the best!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (3,735)