+ Start a Discussion

Flagging a case after hours

I am presented with a problem and was hoping someone here has encountered a similar problem.


My company has recently changed its business hours and the on-call SLA's for our staff.  What I am trying to do is have a checkbox field update when a case is logged through the self-service portal outside of normal business hours.  


I have a checkbox field called "Case Logged After Hours" that is unchecked by default.  I would like that field to be checked when the case is logged between 5:00PM and 8:00AM.  I have two additional business hours settings one "Off Hours PM" and "Off Hours AM".


When the Business Hours field contains Off Hours AM or PM the checkbox will update.  However, I cannot find a way to get the business hours fields to update based on the created date and time.  I can't seem to figure out a way to specify the date and time range to make the fields update.  Also, if I were able to trigger a field update with the createed date and time set properly (everyday from 5:00PM to 8:00AM) I wouldn't need the "Off Hours".


I'd love to hear thoughts on this.




This is a quick thought -- not sure it would work, but here goes. My thought is to use Escalation rules and only set the field during business hours, not outside of business hours.

  1. Create an escalation rule that uses business hours
  2. Set the escalation rule to a really small interval and make sure it is only set to fire based on when the case was created
  3. Change the field "meaning" from outside of business hours to inside normal business hours
  4. Create a workflow field update that sets a field that based the "Escalated" field on the Case equal to True. Maybe you could set a field equal to NOW() or something similar.
  5. Make it the first rule
I'm not completely sure this would work -- and you would have to take into consideration other escalation rules (if you are using them), but it's worth a shot.


We aren't currently using any escalation rules.  There is some plan to use them on a very limited basis so I don't think this would be a problem.  It's certainly worth trying.  I'll let you know if it works.

So in looking at using the escalation rules I seem to be running into the same problem.  Maybe I'm overthinking it but I can't get the Case: Date/Time Opened filter criteria to use the values I need which are:


1: Case: Date/Time Opened > TODAY 12:00 AM


2: Case: Date/Time Opened < TODAY 8:00 AM   




3: Case: Date/Time Opened > TODAY 5:00 PM


4: Case: Date/Time Opened <= TODAY 11:59 PM


(1 AND 2) OR (3 AND 4)


The filter will allow me to use TODAY but not TODAY plus a time.  If I use a specific time I have to use the M/D/YYYY format and time.





Message Edited by Tizzz on 03-31-2009 09:21 PM
There is actually a Business Hours function you can setup, and then use that in your escalation rules. Check the online help for Business Hours -- it will make more sense after you read on up on it. Business Hours can also be setup to exlude weekends and with Spring 09, holidays.
Message Edited by Mark Silber on 03-31-2009 10:02 PM

Thanks Mark - but I really must be missing something obvious because I've been looking though the information on Business Hours and I'm still not seeing any functionality that will help with the field updates.  I have 3 separate entires in business hours:


1 - Regular Business Hours (M - F 8AM - 5PM) *Default

2 - AM Off Hours (M-F  12AM - 8AM)

3 - PM Off Hours (M-F 5PM -11:59PM)


When a new case is submitted through the self-service the default value is used regardless of the time the case was submitted.  I can't seem to find any way to get Salesforce to recognize when a case has been logged after business hours and update fields accordingly.  If I manually change the business hours field (to either of the off hours values) then my other field updates work fine.  Unfortunately that defeats the purpose of needing the field updates and special handling in the first place.


But it's late - I'll keep looking.


Tired as I am - I think I may have solved it.  I'll know for sure if the AM off hours update in the morning.

I hope it works -- there are probably a few different ways to achieve this, but I think Business Hours will be the one that gives you the most flexibility, especially around being able to set weekends and holidays. There is a field on the Business Hours setup screen, 'Default Business Hours', that should automatically set all new cases with the business hours you specify. You can add the Business Hours field to your case page layout to see if it's being set properly.


You should only need 1 Business Hours entry. The only time you should have more than 1 is if you have multiple support groups that operate under different business hours.

Message Edited by Mark Silber on 04-01-2009 05:20 AM



My changes seem to be half working.  Or possibly not working at all.  I'm able to use the escalation rule to update the busines hours filed in the case but I still can't get it to differentiate between the three different Business Hours entries I have created.


As for support groups my company has two different support groups for cases.  Out primary support from 8am - 5pm and the overnight from 5pm - 8am.  However, the business hours don't allow me to create one entry that covers the 5pm to 8am.  I have to break it up into three groups a (12am-8am) an (8am-5pm) and (5pm-12am) .


I can't get Salesforce to use the correct business hours when the case is created.



You should set the business hours to match your normal working hours, not the after hours support hours. If a case is logged during normal business hours, then it will flag the record. I'll try to think of how to do this in a formula field to simplify things.

Thanks for you help Mark.


I know I'm missing something really basic here - perhaps seeing the formula will make more sense, beacuase right now the Business Hours and Escalation Rules just aren't making sense to me.


Thanks again.