web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add a task to planner ...
Power Automate
Answered

Add a task to planner with a due date that excludes Weekends

(0) ShareShare
ReportReport
Posted on by 62

Hello,

 

I need to Add a task to planner with a due date that excludes Weekends, once an email comes in it successfully adds however I have not been successful in getting it to only calculate business (weekdays) days.

 

I'm using the add days which works however I've tried if and switch statements which do not work.

 

 

Categories:
I have the same question (0)
  • Mancino Profile Picture
    62 on at
     

    Here is a picture of the flow.

    Flow.png

  • v-alzhan-msft Profile Picture
    on at

    Hi @Mancino ,

     

    Could you please explain more details about your issue and your requirement?

     

    Best regards,

    Alice       

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

  • Mancino Profile Picture
    62 on at

    Hello @v-alzhan-msft 

     

    I'm trying to create a flow that will post a message to teams when an email is received, after it posts the message in teams, I'd like to create a task in the shared planner. This part is successful.

     

    I also want it to add a Due Date to the task, the due date needs to be 3 days from when the task is created however I need it to exclude making the due date on a Saturday or Sunday.

     

    Current Outcome Example: Email received on 12/18/19 -> Task Created in Planner with due date of 3 days -> Due Date 12/21/19(Saturday)

    Desired Outcome: Email received on 12/18/19 -> Task Created in Planner with due date of 3 days -> Due Date 12/23 (after checking that 12/21/19 is a Saturday.

  • efialttes Profile Picture
    14,756 on at
    Hi
    You can apply dayOfWeek function to the result of adding three days, if result is 0 (sunday) add one more, if the result is 6 (saturday) add two more.
    Or, apply it to startDate, so depending on the result, you calculate DueDate by adding 3, 4 or 5 days.
    https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#dayOfWeek
    Hope this helps
  • Mancino Profile Picture
    62 on at

    @efialttesthanks for the quick reply! I tried the day of week function however that didn't seem to work how it should have.

     

    In this flow example, where would you place that?

  • Verified answer
    efialttes Profile Picture
    14,756 on at

    @Mancino 

    In of the possible approaches is the following:

    1.- Use a variable (in the example I call it 'DueDate') to evaluate Date email is received, and calculate DueDate based on the weekday. I am using a Switch for this purpose, you can use nested Conditions, or sequential Conditions, or...

    Flow_weekdays.png

     

    2.- Use the variable as input for New Planner Task Due Date

     

    One more comment. From your testing experience with the flow you are building, is ReceivedDateTime from "When an email arrives" identifying properly your local Date and Time?

    Hope this helps

     

  • Mancino Profile Picture
    62 on at

    @efialttesThat worked! Thank you very much!

     

    As of right now, yes it shows correctly, I'm not focusing on time, just the date.

  • Mancino Profile Picture
    62 on at

    @efialttesso I know I marked as solved however I'm trying to combine the two flows and I think I figured out, all of the same from previous however instead of checking for RE: I'm checking to see if the there is a task that exists based off the email subject..

     

    If it does, then I check for body containing got this, if not I create a task.

     

    However, I'm having 2 issues at the moment.

     

    1. It doesn't look like it's actually defining the subjectrimmed variable, is this because the email isn't starting with "RE: "?, it's also doing this with the DueDate variable, it almost looks as though it isn't pulling them down from the top of the flow.

    2. It looks as though it's posting based on a FOR-EACH loop which I can't figure out how to turn off, example - if I have 3 tasks present in planner, it posts to Teams for each task in planner..

     

    Any thoughts?

  • efialttes Profile Picture
    14,756 on at

    @Mancino 

    Not sure I understood your new issues. Can you share a screenshot of your current flow?

    Thanx!

  • Mancino Profile Picture
    62 on at

    @efialtteshere ya go. So I have it initialize/set the variables which seems to work.. I'm basically trying to check if the current task exists, if it doesn't create it.. if it does, check the body and go from there.

     

    1. It keeps processing per task, not matching or checking if the task I'm looking for exists.

    2. When it gets down to create the task, its saying the title is empty and the duedate is invalid, almost as if it's not pulling the variables that have been set prior.

    NewFlowVariables.pngNewFlowCondition.pngNewFlowTask.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard