How to filter Groups field in the new On-Call Schedule Wizard (New York)


Description

This KB will point you in the right direction on where you would need to make your customizations.

Release or Environment

New York and above

Instructions

    getAccessDetails: function() {
var details = {};
details.isRotaAdmin = new OnCallSecurityNG().rotaAdminAccess();
if (!details.isRotaAdmin) {
var userSysId = gs.getUserID();
details.groupIds = this._filterGroupsByAccess(userSysId);
}
return details;
},

_filterGroupsByAccess: function(userSysId) {
var ocsNg = new OnCallSecurityNG();
var filteredGroups = {};

// directly managed groups
var userGroupGr = ocsNg.getManagedGroups(userSysId, true);
while (userGroupGr.next())
filteredGroups[userGroupGr.sys_id + ""] = true;

// managed groups through delegation
var userHasRoleGr = ocsNg.getDelegatedGroups(userSysId);
while (userHasRoleGr.next())
filteredGroups[userHasRoleGr.granted_by + ""] = true;

// managed groups through preferences
var groupIds = ocsNg.getManagedGroupsByPreferences(userSysId);
groupIds.forEach(function(groupId) {
filteredGroups[groupId] = true;
});

return this._getKeys(filteredGroups);
},