I am currently trying to set the due date for a task (Using MS Planner in the workflow) to 2 days after something is submitted. However, I want to exclude weekends from this calculation (sort of like business days).
addDays(triggerOutputs()?['body/receivedDateTime'], 2)
I did try the following but was told it was an "invalid input":
if(dayOfWeek(triggerOutputs()?['body/receivedDateTime']) >= 4,
addDays(triggerOutputs()?['body/receivedDateTime'], 4),
addDays(triggerOutputs()?['body/receivedDateTime'], 2))
I'm not entirely sure what is causing it to be invalid. The "triggerOutputs()?['body/receivedDateTime']" part is confirmed to work as the regular statement that doesn't factor in weekends works just fine.
instead of '>=', you should user the greaterOrEquals() function:
if(greaterOrEquals(dayOfWeek(triggerOutputs()?['body/receivedDateTime']),6),addDays(triggerOutputs()?['body/receivedDateTime'],4),addDays(triggerOutputs()?['body/receivedDateTime'],2))
I edited this to add a missing parentheses, otherwise it works perfectly