cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Set a due date for a specific day

I have created a flow that will automatically create a sharepoint list item and a task in planner when a new email arrives into an inbox.

I was asked if there was a way to have all of the newly created tasks to have a due date of Saturday when created.  This has posed some problems in that I cannot use a specific date nor can I use a specific number of days to add or subtract from the current date.

If there was an option in the dynamic content to select a specific day of the week for due date then that would be optimal, but in the meantime is there a way to do this either through the expressions or using another connector?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @RobMichaels ,

 

Do you want to set the Due date for the task, and the Due date needs to be this Saturday?

I'm not sure if the email is received on Saturday or Sunday, then how to set the Due Date, could you provide a specific example?

I tested it here. By default, if received an email on Saturday, then Due Date is the current date; if received the email on Sunday, Due Date is next Saturday.

You could refer to this method to configure your Flow:

  • Use the dayOfWeek() function to get the date of the day to be the day of the week, then subtract from 6 and get a difference of a few days from this Saturday. Sunday is a special case and Due Date will be postponed to next Saturday.
  • Then use addDays() function to get the date of this Saturday and configure this date in Due Date.

Expression reference:

sub(6,dayOfWeek(triggerBody()?['DateTimeReceived']))
addDays(utcNow(),outputs('sub'),'yyyy-MM-dd')

Image reference:

18.PNG

Please take a try and feel free let me know if you have any question.

 

Best Regards,

Community Support Team _ Barry
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

1 REPLY 1
Community Support
Community Support

Hi @RobMichaels ,

 

Do you want to set the Due date for the task, and the Due date needs to be this Saturday?

I'm not sure if the email is received on Saturday or Sunday, then how to set the Due Date, could you provide a specific example?

I tested it here. By default, if received an email on Saturday, then Due Date is the current date; if received the email on Sunday, Due Date is next Saturday.

You could refer to this method to configure your Flow:

  • Use the dayOfWeek() function to get the date of the day to be the day of the week, then subtract from 6 and get a difference of a few days from this Saturday. Sunday is a special case and Due Date will be postponed to next Saturday.
  • Then use addDays() function to get the date of this Saturday and configure this date in Due Date.

Expression reference:

sub(6,dayOfWeek(triggerBody()?['DateTimeReceived']))
addDays(utcNow(),outputs('sub'),'yyyy-MM-dd')

Image reference:

18.PNG

Please take a try and feel free let me know if you have any question.

 

Best Regards,

Community Support Team _ Barry
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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

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 (9,228)