Hi ,
The following formula field calculates the Due Date provided the Today() date and numberOfDays to be added to the Today() date excluding Saturdays and Sundays in the flow.
CASE(
MOD(TODAY() - DATE(1900, 1, 7), 7),
0, (TODAY() ) + numberOfDays + FLOOR((numberOfDays-1)/5)*2,
1, (TODAY() ) + numberOfDays + FLOOR((numberOfDays)/5)*2,
2, (TODAY() ) + numberOfDays + FLOOR((numberOfDays+1)/5)*2,
3, (TODAY() ) + numberOfDays + FLOOR((numberOfDays+2)/5)*2,
4, (TODAY() ) + numberOfDays + FLOOR((numberOfDays+3)/5)*2,
5, (TODAY() ) + numberOfDays + CEILING((numberOfDays)/5)*2,
6, (TODAY() ) - IF(numberOfDays>0,1,0) + numberOfDays + CEILING((numberOfDays)/5)*2,
null)
Here numberOfDays is flow variable.
Example Scenario:
When an Account is created, a task should be created with a due date set to 5 days from today.
Reference:
https://help.salesforce.com/s/articleView?id=sf.formula_examples_dates.htm&type=5
No comments:
Post a Comment