cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
giangnguyen
Helper I
Helper I

Duedate but will not be counted on Saturday and Sunday

Dear All,

When submitting the form, the process will planner create a task with a duedate of 3 days, but if it is Friday, it will not be charged on Saturday and Sunday, but will be charged on Friday, Monday and Tuesday. Thanks you.

1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

Hi @giangnguyen ,

 

Do you mean Submission Time as Start Date, then add three days as Due Date and exclude weekends day?

You could refer to the following method to configure Flow.

  • Initialize three variables, Date is used to indicate the date that may be included in the task, Number is used to control the loop, and the last variable is used to record valid Dates.
  • Use dayOfWeek() function to exclude Saturday and Sunday and append the valid date to the array.
  • Each loop requires a day plus of Date.

Expression reference:

 

formatDateTime(body('Get_response_details')?['submitDate'],'yyyy-MM-dd')
dayOfWeek(variables('Date'))
addDays(outputs('CurrentDate'),1,'yyyy-MM-dd')

Image reference:

 

4.PNG

Details of Apply to each:

5.PNG

Details of Do Until:

7.PNG

Details of Condition:

8.PNG

Please take a try.

 

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

2 REPLIES 2
Pstork1
Dual Super User III
Dual Super User III

Try the following formula.  Replace Datepicker with the field for your duedate.

If(Weekday(DateAdd(DatePicker1.SelectedDate,3,Days))<2,
DateAdd(DatePicker1.SelectedDate,4,Days),
Weekday(DateAdd(DatePicker1.SelectedDate,3,Days)) >6,
DateAdd(DatePicker1.SelectedDate,5,Days),
DateAdd(DatePicker1.SelectedDate,3,Days))


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
v-bacao-msft
Community Support
Community Support

Hi @giangnguyen ,

 

Do you mean Submission Time as Start Date, then add three days as Due Date and exclude weekends day?

You could refer to the following method to configure Flow.

  • Initialize three variables, Date is used to indicate the date that may be included in the task, Number is used to control the loop, and the last variable is used to record valid Dates.
  • Use dayOfWeek() function to exclude Saturday and Sunday and append the valid date to the array.
  • Each loop requires a day plus of Date.

Expression reference:

 

formatDateTime(body('Get_response_details')?['submitDate'],'yyyy-MM-dd')
dayOfWeek(variables('Date'))
addDays(outputs('CurrentDate'),1,'yyyy-MM-dd')

Image reference:

 

4.PNG

Details of Apply to each:

5.PNG

Details of Do Until:

7.PNG

Details of Condition:

8.PNG

Please take a try.

 

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
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

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

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (71,161)