Where can I find the API document for SNC.OnCallRotation class?

tongguo_pang
Mega Contributor

Is there some document similar as GlideRecord for the OnCallRotation class?

9 REPLIES 9

arya6
ServiceNow Employee
ServiceNow Employee

Hi Tongguo,



I would recommend that you create a script include that is in the "Global" application scope and accessible from "All application scopes".



In this script include you should be able to reference the OnCallRotation scriptable class with SNC.OnCallRotation in order to perform the necessary operations. The rest of your application can remain in scope, so a business rule defined in your scope will be able to reference your newly created script include because it is accessible from "All application scopes".



The SncOnCallRotation script include does not have an implementation for "getEscalateeAt(String groupID, GlideDateTime dateTime, Number position)", I would not recommend adding it as it will mean modifying an OOB script include; meaning future updates will be missed on that file. Furthermore, this script include is only accessible within the "Global" application scope, which is why creating a new script include that serves your needs is the way to go.



Thanks,


Arya


Hi Arya,



Thanks again for the reply.



However, since we need to get our app certified, I don't think I can have some components in the global scope, is this correct?


You are correct. In this case raise a ticket in HI explaining you use case. They might add a function accessible for scoped apps in order for your app to work.


benvargas-adapt
Kilo Explorer

Did you happen to get a workable resolution to this issue? I have run into the same limitation of the OnCallRotation API only being available in the global scope, but I wish to use it in a certified application on the ServiceNow store. Thanks!


It is not ideal, but I did find that the OnCallRotation global script include is accessible from other application scopes and this is at least getting me primary on-call.



I would rather be using SNC.OnCallRotation() modeled after the On-Call workflows for obtaining various levels given a GlideDateTime, but this might help others...



var rota = new global.OnCallRotation();


rota.who(groupGR.sys_id + ''); // Establish a sys_user_group GR or pass sys_id of a Group; just be sure you pass a Group sys_id.


while (rota.next()) {


      gs.debug('getPrimaryUserName: ' + rota.getPrimaryUserName());


      gs.debug('getPrimaryUser: ' + rota.getPrimaryUser());


}