You are viewing limited content. For full access, please sign in.

Discussion

Discussion

Calculate Observed Holidays in Workflow

posted on December 2, 2020

I work at a Financial Institution where we observe federal holidays and are sometimes closed for an in-service day. As we know with holidays, the date can differ from year to year or the date of observance can change if it falls on a weekend. A number of our Laserfiche Forms start workflows and a number of our workflows send reports, email notifications or contain HTTP Form Post activities that we would not want to run on an observed holiday.

I am not a skilled programmer (and maybe you aren't either) and so I decided to create a workflow without custom activities that would calculate our observed holiday dates for the current year and would not require yearly maintenance. I designed this workflow to be invoked by another workflow whenever holiday dates needed to be checked and then pass the dates back to the parent workflow in a multi-value token.

I'm sure this could be done many different ways, this is just the solution I came up with. I'm happy to hear any suggestions or improvements you may have.

I included an image file for visual learners, and then a txt file containing a summary of what was done within each activity. I also added an Output parameter token called "Observance Days" that the final activity modifies if another workflow started this one.

I hope that this proves to be useful to someone. :)

 

 

Calculate Current Holiday Closures.png
2 0
replied on November 7, 2024

Hi, we have supported configuring holiday calendars on Forms 12 as well.

You can see other changes from: Laserfiche 12 Changelog

Get Laserfiche Forms 12 package from: Laserfiche 12 - Downloads

0 0
replied on December 3, 2020 Show version history

There's actually a much much easier way to do this.

In the Workflow Administration Console, you can configure your observed holidays with quite a bit of precision; there are some gaps but you can get around those with customized holidays.

For example, with the observe on Friday if Saturday or Monday if Sunday situation, I just checked the calendar ahead for a few years and created custom rules to cover anything that didn't work with the built-in options (although I did put in a feature request to address those scenarios so the more people who ask for it the more likely it is we get it lol).

You can customize existing holidays, or you can add your own custom ones depending on your needs.

Then, on the Workflow side, just use the Token Calculator (not Date Token Calculator) and the WORKDAY function, which will automatically exclude the weekends/holidays you configured.

For example, I frequently use a formula like this to find the "business day closest to today" 

WORKDAY(WORKDAY(%(Date),-1),1)

So if the input date was a normal Friday, it would subtract 1 to get Thursday, then add one to end up back on Friday. If that Friday was the Friday after Thanksgiving, it would subtract 1 to get Wednesday (since Thursday would be a holiday too), then add one ending up with the following Monday.

1 0
replied on December 3, 2020

Ahhh, I did not know about the Workday function within the token calculator. Thank you, that is very helpful! I'll play around with that.

I have configured holidays within the Workflow Admin Console and it does work for most of them. However I found the exception options to be limiting. For example, if Independence Day fell on Saturday, we would observe it on Friday but if it fell on a Sunday we would observe it on Monday. So using the "Moved to the next business day" or "Moved to the previous business day" options wouldn't work in cases like that. Or am I missing something?

0 0
replied on December 3, 2020 Show version history

Yea, I ran into the same situation because the "previous" or "next" business day really isn't enough considering it depends on if it is a Saturday or Sunday for many of our holidays.

What I was saying before is that I just looked a few years ahead in the calendar and added custom holidays to account for those scenarios, and fortunately there weren't that many that were affected.

For example,

I've requested a change to support different previous/next behavior based on whether it falls on a Saturday or Sunday, but requests like that sometimes need more people asking for it before they gain traction.

Feature Request: Granular Weekend Rules for Workflow Holidays - Laserfiche Answers

2 0
replied on December 3, 2020

Oh now I understand what you did to get around it. Very nice! I agree, that looks like the cleanest option for someone who knows what they're doing and would last for several years.

I'm actually leaving my workplace to go on indefinite maternity leave, so I was looking for a near zero maintenance solution since they haven't found a replacement for me.

I'll vote on your Feature Request post. ^_^

0 0
replied two days ago

Hi Jason,

 

I was looking for something and I found this thread. My issue is similar. How can I determine if the input falls on a holiday in Laserfiche? I want to record the form submission on holidays and weekends and just cannot get my head around it. If a form submitted on a weekend or holiday, I'm going to assign a field to my entry. I'm pretty sure its something super simple. When I check Token Calculator, it always compares the dates. I tried using Workdays but not what I'm looking for. I sent the holidays on admin console. There should be way to say today is a workday or not. Would you be able to help me out?

Thank you very much!

 

0 0
replied two days ago

@████████ You can still use the Workday function. Workdays with an s provides a count, but Workday returns a date offset by the input amount.

An easy approach is to add 1 workday, then subtract 1 workday from that date, then compare the result to the original date to see if they still match.

I use the following in a Date Token Calculator.

WORKDAY(WORKDAY(%(Date),-1),1)

If the resulting value does not equal the %(Date) token, then the current date is not a work day.

For example, if today is Saturday, we subtract 1 work day which puts us on Friday, then when you add 1 work day you get Monday.

If today is Monday, we subtract 1 work day to get Friday, and when we add 1 work day back we get Monday again.

1 0
replied one day ago

Ahh I see the logic now thank you for your answer. And for holidays once we set them up in WF admin console and make them observed, would the same logic applies to this token too or is there something else? I was testing with this and the weekends works as you said but it seems like the holidays are not working. For example July 1st is Canada day and its a Tuesday this year. When I use WORKDAY(WORKDAY(%(Date),-1),1) and put 07/01/2025 as date, it comes back as 07/01/2025 again instead of 07/02/2025

0 0
replied one day ago

Holidays have always worked for me, including custom holidays. Anything enabled under the Holidays and Weekends section in the admin console should apply.

1 0
replied one day ago

Ok thanks Jason!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.