On-Call Calendar breaking My Calendar and Resource Management anyone have a workaround?

akaupisch
Kilo Guru

I've already submitted a ticket with SN, but I'm doubtful we'll see a resolution anytime soon. The only workaround they suggested is through Delegates, but even that doesn't solve our issue. I'm hoping someone on here can point me in the right direction...

Background:

We have Calendars (schedules) setup for each user in our system following a typical 40 hour work week. When they click on My Calendar it all looks great. When you go through Resource Management, it shows 40 hours for that user, again, great. We also use the On-Call Calendar and have automatic rotations setup (e.g. You are in a group with 2 other people...so 3 total people, every 3 weeks you are on call and it's a 24x7 on call that week). If you never touch anything, it works perfectly.

Issue:

Say you need someone to cover your on call. There are 2 ways of doing this and thus 2 issues as neither works properly.

1) Go to the on-call calendar and create a new entry for the time you are covering. In this case, say Bob is on call this week but needs Fred to cover all day Wed (midnight to midnight). Fred (or Bob) goes into the on-call calendar, and creates a new entry for this (which creates an entry into the roster_schedule_span table). This entry links to the schedule for that user and also creates an entry in the cmn_schedule_span table as 'on_call'. It renders in the On-call Calendar just fine, however, it has now mucked Fred's Calendar (it'll show Fred being 'available' from midnight to midnight)...It now shows him as having a 56 hour week instead of a 40 hour week in Resource Management (and his calendar). This is a problem because being oncall doesn't mean Fred is actually working during that time, yet PMs can request him during that time through Resource Management.

2) (the workaround SN told us to use)...Same situation, Bob is on call, needs Fred to cover. Bob creates a delegate during this time and now all tickets go to Fred during this time. However, this is not represented in the on-call calendar...it still shows Bob on-call during that time (This is super problematic as we have multiple departments who might need to reach out to Bob's group...the only way to do this is to view the on-call calendar for Bob's group...in this case it shows Bob...they call Bob but he's not answering...very bad for a hospital)

Both issues are bad...in one case you have the on-call calendar correct and the resource calendar incorrect...in the other case the resource calendar is correct but the on-call calendar is not.

My Assumptions:

Issue 1) It would appear that whatever is used to render the resource calendar   is not respecting the 'type' (in this case being 'on_call') and is returning all spans for that user, when, in fact, it should be ignoring PTO and On-Call (or if it were to show it, it should do so in a different color). Regardless, Resource Management is probably using this same code and isn't respecting that on_call is not actual working hours. I would love to change this code, but I don't see any script includes, ui scripts, or business rules that return this data. The URL for the calendar references ("/show_resource_schedule.do?sysparm_resviewtype=calendar") But it looks like show_resource_schedule.do is back-end and we don't have access to it

Issue 2) It would appear that the on-call calendar is not respecting delegates and not rendering them properly. It should be looking at whomever in delegated and displaying that instead. However, just like Issue 1, all of that seems to take place in code that I do not have access to or simply cannot find...

Alternative) Somehow ignore the calendars and focus on Resource Management. Determine what is returning the spans and hijack them to not include those extra hours. Total hack and probably requires too many changes...

Solutions? Thoughts?

1 ACCEPTED SOLUTION

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Believe I have a workaround for you, at least it works for me with a quick test.   Query business rules are a great feature with many uses but in a nut shell they can apply filters in the background.   Basically my solution leverages one that will detect that the URL is coming from Resource Management and if so filter out the On-Call schedule entries.



  1. Go to System Definition\Business Rules and click New.
  2. In the Name field enter something like Schedule Entry Query.
  3. Set the table to Schedule Entry (cmn_schedule_span)
  4. Check the Advanced Checkbox
  5. Ensure When on the When to run section is set to before
  6. Check the Query checkbox on the When to run tab
  7. On the advanced tab, enter the following script and then submit the record.

(function executeRule(current, previous /*null when async*/) {



      var map = gs.action.getGlideURI().getMap();


      var referringProcessor = map.get('sysparm_processor').toString();


      if (referringProcessor.indexOf("com.snc.resource_management") > -1) {


              var qc = current.addQuery("show_as", "!=", "on_call");


      }



})(current, previous);



You can add other conditions but basically the way I got here is I logged the URI to determine what I could filter on.   To do this, I simply put in a statement in this script include:


gs.log(gs.action.getGlideURI());



The results from when I was viewing the Resource Schedule showed this in the log:


xmlhttp.do?end=2016-9-25+00%3a00%3a00&ni.nolog.x_referer=ignore&start=2016-9-18+00%3a00%3a00&sys_id=&sysparm_processor=com.snc.resource_management.AjaxResourceSchedule&sysparm_scope=global&sysparm_type=get&sysparm_want_session_messages=true&user_id=&x_referer=show_resource_schedule.do%3fsysparm_resviewtype%3dcalendar



So I chose to get the sysparm_processor from that URI and look for it to apply a filter of NOT including on_call schedule entries.



I hope this helps!   Please mark this post as helpful or the solution to your question.


View solution in original post

7 REPLIES 7

Adam, inherited tabled do indeed run business rules of the parent table.   You will find many out of the box examples of this with business rules that are set for task that also affect incident, problem, change, etc.



I suspect the issue is that there is no index on the show_as column and we are querying for that in the business rule.   You can view the online documentation on creating one like the following article or you can work with customer support to get that setup:


Improve performance by creating database indexes via the User Interface



I would recommend trying this first in a dev or test environment where you are experiencing the issue to validate this solves it.


akaupisch please update your Hi ticket if you haven't already with this proposed solution.


Uncle Rob
Kilo Patron

Thread zombie, I know.  I'm having *almost* this exact same problem.
Thing is, for anyone that's gone one of their own named schedules, the availability in Resource Management is showing a big fat zero.

How do you make these two things cooperate!?!