
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 03:07 PM
One issue we are running into with the on-call calendar is that when a user is deactivated they are still active in the on-call calender rotation. HI indicated this is a bug that they will work out sometime in the future but don't know when.
My idea for a workaround is to remove them off the on-call rotation table in a scheduled job, but i am finding that the overall rotation now has gaps from where the user was. I know if you go into the groups rotation and save any change, the schedule will rebuild which would remove all the gaps in the schedule from the missing user. So I'm looking for a way to get the schedule to rebuild in my script. I am fairly new at scripting, but this is what I have so far:
//Clears out inactive users from the on-call rota
//table to remove records on
doit("cmn_rota_member");
function doit(table) {
var gr = new GlideRecord(table);
gr.addQuery('member.active', '=', 'false');
gr.query();
gr.deleteMultiple();
}
Thanks in advance for any help!
Alex
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2016 12:13 AM
Try this in any sub prod instance first
var rotaSysID='';
var gr = new GlideRecord('cmn_rota_member');
gr.addQuery('member.active', '=', 'false');
gr.query();
while(gr.next())
{
rotaSysID=gr.roster.rota.toString();
gr.deleteRecord();
var getRelatedRota = new GlideRecord('cmn_rota');
if(getRelatedRota.get(rotaSysID))
{
getRelatedRota.setForceUpdate(true);
getRelatedRota.update();
}
}
This should trigger the business rule.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2016 01:48 PM
This works great, thank you!!!