This is done after the SharePoint list is customized using InfoPath.
Follow the steps below to prepopulate the Date & Time field to 5 business days from today.
- Add a text field and remove it to appear on the form.
- Under Data tab add the rule below to set the textbox with below formula.
(number(substring(today(), 9, 2)) + number(number(substring(today(), 1, 4)) - floor((14 - number(substring(today(), 6, 2))) / 12)) + floor(number(number(substring(today(), 1, 4)) - floor((14 - number(substring(today(), 6, 2))) / 12)) / 4) - floor(number(number(substring(today(), 1, 4)) - floor((14 - number(substring(today(), 6, 2))) / 12)) / 100) + floor(number(number(substring(today(), 1, 4)) - floor((14 - number(substring(today(), 6, 2))) / 12)) / 400) + floor(31 * number(number(substring(today(), 6, 2)) + 12 * floor((14 - number(substring(today(), 6, 2))) / 12) - 2) / 12)) mod 7 + 1
NOTE: This not my formula and I lost the URL where I found this. Please if anyone knows it, please cite it here.
- Above formula returns 1 if Sunday, 2 if Monday and so on.
So in my case to add 5 business days, I added 3 rules, one for weekday, one for Sunday and one for Saturday.
1. Weekday Rule: textbox = 2 or textbox =3 or textbox =4 or textbox = 5 or textbox =6
set due date = adddays(now(),7).
Check Don’t run remaining rules. This is very important
2. Sunday Rule: textbox = 1
set due date = adddays(now(),5)
Check don’t run remaining rules
3. Saturday Rule: textbox = 7
set due date = adddays(now(),6)
Check don’t run remaining rules
All the above rules are calculated on form load.