function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShariqueUl_BariShariqueUl_Bari 

Exclude Holidays from Workflow Time Trigger

Hi Everyone. I have a requirement where I need to use a Workflow time trigger to fire after 24 hours (1 day) of the criteria being met. But, this needs to consider Holidays and exclude them when executing the time trigger, for e.g. when the next day (since time trigger is set for 1 day, so next day) is a Holiday, it must fire after 2 days.

Note: We do not need to exclude weekends (Saturdays and Sundays) but only the Holidays must be excluded.

I have come accross some articles that talk about using a custom formula field and the time trigger to execute based on that formula field but most cases exclude weekends (which I do not want) as well and/or do not consider excluding Holidays.

Any ideas around how to acheive this will be largely helpful.

Thanks,
Sharique
Amit Chaudhary 8Amit Chaudhary 8
I dnt think so you can do same with Workflow. I hope you need to do custom coding for same
RD@SFRD@SF
Hi Sharique,

There is a way of achieving it using WF config.
 You would need two workflows though.

Workflow 1: When the criteria are met you calculate the next business day and update a date field on the record. (A new date field is needed here which would hold the date the trigger needs to happen) 
Workflow 2: When the date field is populated, the actions are set up to trigger after 0 hours of the new date field.

To calculate the next business day.

1. Take a Monday date for instance (1,1,1900).
2. Subtract this day with the rule trigger date, use today function if needed.
3. Do MOD 7 on the result and use case function to get the result and update the business day returned.
4. This way you can find which weekday it is and for Saturday add two days, for Sunday add one day.

Voila, and you get what you need.
If you need help in the next business day calculation follow the below salesforce reference link
https://help.salesforce.com/articleView?id=formula_examples_dates.htm&type=5

and search for "Finding and Displaying the Day of the Week From a Date"

Hope it helps
RD
 
ShariqueUl_BariShariqueUl_Bari

@RD - Thanks fo your response.

The issue I'm running into here is that in the above next business day calculation, it considers Saturdays and Sundays which I don't want. I want to consider only Holidays and I don't think there's any way I can consider excluding Holidays (for e.g. Jan1, Dec 25 etc.) in a formula field, or can I? Please let me know if there is a way I can exclude only Holidays in my next business day calculation.

Just to reiterate: My next business day should only consider excluding Holidays and not weekends i.e. Saturdays and Sundays are also considered as business days.

Thanks,
Sharique

RD@SFRD@SF
How many of these holidays do you have?
ShariqueUl_BariShariqueUl_Bari
It's a long list. Probably more than 25.
RD@SFRD@SF
Hmm, then I guess we would have to use the Holidays property that they are well distributed across the different months.

Two ways to do it.

Way 1 -> In the first WF, update the field update to check the month and date and add days accordingly. But the formula would be needed to be updated for the following year as the holiday days would change year to year.

Way 2 -> Record these holidays on a custom object and use an auto-launched flow to get the holidays and compare that with the holiday date and give you the next working day. And the rest would be taken care by the second flow.

 
ShariqueUl_BariShariqueUl_Bari
Thanks @RD. I'm going to try it out and post you.
Ally TAlly T
Did you find a solution to exclude specific holidays only? I'm trying to solve the same problem!