- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 02:58 AM
Hi Team,
Please help me to write a script that will return a list of the currently active on-call roster and associated on-call members based on the assignment group passed as a parameter.
Thanks in advance
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 04:50 AM
by using onCallRotation api I am able to achive the requirnment.
var groupSysId = '096fb59173062300e7af6238edf6a783';
var currentTime = new GlideDateTime();
var onCallRotation = new OnCallRotation();
var escalatees = onCallRotation. whoIsOnCall(groupSysId, "", "", currentTime);
gs.log(JSON.stringify(escalatees));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 03:23 AM
This will give you all associated schedules with a group and its primary secondary members.
You can add more queries as per your need:
Try this in background script:
oncall('287ebd7da9fe198100f92cc8d1d2154e'); //sys_id if group
function oncall(assignment)
{
var gr = new GlideRecord('cmn_rota');
gr.addQuery('group',assignment);
gr.query();
while(gr.next())
{
//gs.print(gr.sys_id);
var gr1 = new GlideRecord('cmn_rota_member');
gr1.addQuery('roster.rota',gr.sys_id);
gr1.query();
while(gr1.next()){
gs.print("group name:"+ " "+gr.group.name+" "+ "Member:"+" "+gr1.member.name);
}
}
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 03:45 AM
I want the current shift group members only. So which query parameter I have to use for it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 04:07 AM
What is the exact requirement? current shift means, current time?
You can refer:https://community.servicenow.com/community?id=community_blog&sys_id=347c22e1dbd0dbc01dcaf3231f96199a blog for details of scripts in on call.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 04:50 AM
by using onCallRotation api I am able to achive the requirnment.
var groupSysId = '096fb59173062300e7af6238edf6a783';
var currentTime = new GlideDateTime();
var onCallRotation = new OnCallRotation();
var escalatees = onCallRotation. whoIsOnCall(groupSysId, "", "", currentTime);
gs.log(JSON.stringify(escalatees));