Where can I find the API document for SNC.OnCallRotation class?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2016 02:19 PM
Is there some document similar as GlideRecord for the OnCallRotation class?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2016 12:26 AM
If it is not documented on the developer-portal (ServiceNow Developers ) than it means it is not supposed to be used by customers. You can do it at your own risk meaning it might break with a further upgrade.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2016 07:45 AM
Hi Fogg,
thanks for your reply. I have some more questions. What I am trying to do is to get all on-call users (primary, secondary etc) at the time an incident is created. My questions are:
1). I figured out to get them. The way i did is: use the OncallRotation script include to get the primary user. I then query the cmn_schedule, cmn_rota, cmn_rota_roster table to find the secondary, tertiary etc) users, do you think this is the correct way to do it?
2). If not, do you have any suggestions how to do it?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2016 03:10 AM
Hi Tongguo Pang,
Here is the documentation for the OnCallRotation API for Geneva.
Providing you are interested in just the members that are on-call at the time the incident is opened, I would try something like this (which you can try out in a background script):
Just to clarify, this will produce the escalation plan according to the time specified and the escalation plan defined for your groups rota.
var rota = new SNC.OnCallRotation();
// This may be the assignment_group on the incident
var groupSysId = "0a52d3dcd7011200f2d224837e6103f2";
// This may be the sys_created_on/ opened_at
var currentDateTime = new GlideDateTime();
// The size of the plan represents the number of rosters on-call at this point in time
// Provide the sys_id of the group that is responsible, in this case it may be the assigment_group on the incident
var escalationPlan = rota.getEscalationPlan(groupSysId, currentDateTime);
// This will loop through and get the group members that are on-call for each roster
for (var i = 0; i < escalationPlan.size(); i++) {
var rosterLevel = (i + 1).toString();
// currentEscalatee represents a sys_user GlideRecord
var currentEscalatee = rota.getEscalateeAt(groupSysId, currentDateTime, rosterLevel);
if (!currentEscalatee)
continue;
gs.print(rosterLevel + ": " + currentEscalatee.name);
}
If that helps, please remember to mark it as the correct answer.
Cheers,
Arya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2016 08:02 AM
Thanks Arya,
I believe this is the correct answer. However, since it doesn't seem that the SNC.OncallRotation class is available for scoped apps (it also seems that instead of using new SNC.OncallRotation(), I have to use new SncOncallRotation();), it will return a security exception, saying that SncOncalRotation is not available in scoped app. Do you have more information about how I can use this class in a scoped app?
Thanks again