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?

  • I cant see how they are linked either. The BusinessHours.isWithin method does take holidays into account but only holidays that have been linked to the Business Hours passed into the method. – BarCotter Apr 29 '14 at 16:13
  • I saw that as well. Its just a mystery to me as to how to know if a particular holiday is valid for a particular set of business hours. Puzzling. – Chris Duncombe Apr 29 '14 at 16:17
  • I changed my comment to an answer and provided a bit more info. – BarCotter Apr 29 '14 at 16:18
  • 1
    Yea, I guess I would have to agree, just sad that the answer is 'nope, cant do that'. I'll accept it. – Chris Duncombe Jan 11 '17 at 4:43
  • 1
    Yeah, I agree. Very frustrating to be missing such a basic piece of the API. I don't understand why they don't just expose it. Seems like an afternoon's worth of work for someone on their team. I'll make sure to vote for it. – Adrian Larson Jan 11 '17 at 4:51

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.

  • Interesting. I did not come across this in my research. Thanks for this. I agree with a comment that this seems more like a bug than an Idea. How can they not expose it? – Chris Duncombe Apr 29 '14 at 16:20
  • 1
    I suppose my workaround would be to use the isWithin method because it does only exclude the holiday if it is connected? – Chris Duncombe Apr 29 '14 at 16:21
  • 4 years later, still it is the same! No junction object details provided by Salesforce. – sfdcFanBoy Mar 19 '18 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.