cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RobMichaels
Advocate I
Advocate I

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
v-bacao-msft
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
v-bacao-msft
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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (59,432)