Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

onCallRotation.getEscalatees function not returning on call members for specific shift

Saranya2
Tera Contributor

Hi All,

 

I am facing issue while returning on call members from specific shift. we have 2 shifts (shift A & Shift B) for a single group. I want to use only 1 shift (Shift A) and on call members from that shift in my logic. I have tried below code by passing group and shift (Shift A) as an argument, But it does not return anything. returning empty array []. if I am passing Shift B as an argument it is returning members.. But I need shift A , I am not sure what is the difference &I couldn't figure out the issue.. Can anyone please help me.. Thanks in advance.

 

Note: Both Shift A & Shift B have same members only order is different. 

 

var groupSysId = '8a5055c9c61122780043563ef53438e3'; // group sysid
var onCallRotation = new OnCallRotation();
var rota = '501ae7ada8812300964fb5fe74c31e3c'; // sysid of shift
var result = onCallRotation.getEscalatees(groupSysId, rota);
gs.log(JSON.stringify(result));

 

Thanks,

Saranya

 

5 REPLIES 5

Tony Chatfield1
Kilo Patron

Hi, I would expect onCallRotation.getEscalatees() to return escalatees for only the current\matched shift and so if you have 2 shits the results for the 'active' one would be returned based on time of day that the scritp was run. Also checking a Utah PDI, onCallRotation.getEscalatees() has 6 parameters and your code is only passing in the first 2 which might cause issues.
/nav_to.do?uri=sys_script_include.do?sys_id=1d53492757930300532c3da73d94f93a

 

Hi Tony,

 

Thanks for you response.

  • As you have mentioned I tried to pass all parameters. But I am not sure about the last 2 parameters,  getEscalatees: function(groupIds, rotaIds, rosterIds, gdt, overrideCustomEscalation, taskGr) . I have passed 1st 4 parameters as below.
  • Also, you have mentioned the function return escalatees for only the current\matched shift. I didn't understand the meaning of current\matched shift.
  • I am passing rota & roster as parameter still it is not returning anything for the rota I have passed
  • Is it returing based on time zone we have used in the schedule? Please give me a suggestion to return members for the rota I have passed.

Can you please clarify it, because I am new to the on call module. 

 

var gdt = new GlideDateTime();
var group = '287ebd7da9fe198100f92cc8d1d2154e';

var rot = '71992362eb601100fcfb858ad106fe16';
var roster = '35992362eb601100fcfb858ad106fe16';
var rota = new OnCallRotation();
var currentOnCall = rota.getEscalatees(group, rot, roster, gdt , "");
gs.print("length"+currentOnCall.length);
gs.print("oncall members"+JSON.stringify(currentOnCall));

 

Thanks,

Saranya

Hi, the function is not clearly documented in the script-include, so you would need to work through the code to try and understand or perhaps log a case with nowsupport to have the parameters clarified.

 

Regarding your question about current shift; Oncall is based on a rota\schedule and so I would expect this function to return escalates for the current\active oncall shift at the time the script is run.

Meaning that if you configure oncall shifts that run from 00:00-12:00 and 12:00 - 23:59 with different escalations configured, then I would expect that running this function at 11:59 and 12:01 would produce different results but running at 11:57 and 11:59 would produce the same result as the 'current' schedule is the same.

Hi Tony,

 

I have 2 shifts which has same schedule time  00:00 - 23:59, but still it is not returning the members from the required shift I have passed in the function. If both shift schedule has same time, then which shift it will take as current\active oncall shift?

 

Thanks,

Saranya