[SalesForce] Business Hours and Holiday Affiliation

I have been in the process of creating a Business Hours Engine that calculates business hours. I have used the Case Flags product and like it, but I am looking to build a custom engine so I can take the Case Flags products a few steps further and add functionality they don't currently have. My calculations are working ok, the one issue I have is trying to find any affiliation between the Business Hours class and the Holidays class.

From the Documentation (See Here)

Business hours and escalation rules associated with business hours are
suspended during any holidays with which they are affiliated.

My issue is that there is no link (that I can find) between the Business Hours Object and the Holiday Object. My understanding is that there is a many to many relationship between Business Hours and Holidays, so I would assume there would be some junction object connecting the two. I cannot find any such connection.

There is a blog that touches on the subject (See Here)

This however is making the assumption that all active holidays in the system are valid for the Business Hours you are using. It is possible though to have holidays that are valid for Business Hours X and not valid for Business Hours Y.

I need a way to find all holidays and be able to go through multiple sets of business hours and see which holiday applies to each.

This seems like it should be simple, but can't seem to find any documentation anywhere on this.

Business Hours Object Documentation

Holiday Object Documentation

Just looking to make sure I'm not crazy and missing something. Can anyone shed some light on this for me?

Best Answer

Based on this idea it looks like the junction isn't exposed.

The BusinessHours.isWithin method does take holidays into account but only holidays that have been linked to the Business Hours passed into the method.

Related Topic