cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Business Calendar in unity script? specially to check holidays.

Shital_Varade
Champ in-the-making
Champ in-the-making

I am trying to read holidays from defined/created business calendar in configuration. but I am unable to read it. Can anyone please answer?

2 ACCEPTED ANSWERS

Aki_Daiguji
Star Contributor
Star Contributor

Hi Shital,

None of the OnBase APIs have any functionalities to access OnBase-defined calendars. If you would like an SCR for this functionality, please reach out to the API Support team and request for an SCR.

View answer in original post

Adam_Ryman1
Champ on-the-rise
Champ on-the-rise

Good Morning Shital,

As Aki mentioned, this is not something the Unity API exposes at this time. We recently also had a need to check holidays from the calendar, so as a workaround I was able to come up with the following method which will evaluate whether a DateTime object is a configured holiday or not.

Thanks,

Adam Ryman

IT Software Developer, OnBase

EverBank

View answer in original post

9 REPLIES 9

Hey Dave, glad I was able to help out! Thinking about an external AFKS, I am not sure I fully comprehend what you are trying to accomplish. Keep in mind an external AFKS will trigger when a primary value is entered into a keyword field and then the user selects the tab key within an indexing panel. When the user clicks tab, the secondary values will be filled out. If I understand what you are trying to do, you could retrieve values for population of the AFKS from an external source using a unity script. This would allow you to go directly to the external source and populate the secondary values as you see fit. (this can be a different database) Please let me know if this makes sense or if there is something I am missing!

Tim - Very good point! I actually handle this in my script as well and .NET provides a very easy way to accomplish this using the DayOfWeek enumeration. Please see my method below!

private bool checkWeekend(DateTime date, Application app)
{
DayOfWeek dayOfWeek = date.DayOfWeek;
if (dayOfWeek == DayOfWeek.Saturday || dayOfWeek == DayOfWeek.Sunday)
{
app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Verbose, "This date was Saturday or Sunday.");
return true;
}
else
{
app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Verbose, "This date was not Saturday or Sunday.");
return false;
}
}

Thanks,

Adam Ryman

Hi Tim,

certainly not a fully formed thought on my side - was thinking that by matching the date value on the document using the workflow rule 'Autofill Row Exists' that on True, "This Was a holiday!" and on False "Not a holiday!" I actually don't need - or want - the information from the AFKS on the document, just using it as a look up.

If you want to do this live with a user not after the fact through Workflow processing, then kind of a moot point, unless as you said there is a unity form custom action to call a script - but then we are back to where we started 😉

And thanks for the additional weekday method!

We are actually running this in Workflow specifically using a WF Unity API Script. The scripts goal is to add x amount of business days to a date on a Unity Form. The script will essentially read the original date, add the business days and then take into consideration holidays as well as weekends using the two methods that I have provided. Once we have a day that evaluates false for both we know we have a proper business day calculation. (The number of days to add for us is static but you could make this dynamic using a property bag.)

Hi Adam,
Excellent. That's worked for me.

Great Shital !

Glad that I could help out!
Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.