Notifications

3 views

Description

This weekend the On-Call Schedule - Gaps and Conflicts emails was sent out to all active users. Per the documentation introducing this as a part of the Madrid release, the scheduled jobs that sends this weekly report of gaps and conflicts in on-call schedules should've only gone to the respective shift managers, group managers, and admin. 

Resolution

[code]Solution: [/code]

The root cause of the issue is with the Script Include: 'OnCallSecurityNG'
https://<instance-name>.service-now.com/nav_to.do?uri=sys_script_include.do?sys_id=3f8d56170a0a2c9660fe6df53700fe08

Customizing the script include 'OnCallSecurityNG' will get it skipped during the upgrade.

From the 'On-Call Gaps Conflicts Report' script execution, the function which is used to send emails is from this script include: 'OnCallGapsConflictsReportSNC'
https://<instance-name>.service-now.com/nav_to.do?uri=sys_script_include.do?sys_id=a913e4db731c2300cbb654eb7df6a7be
[code]


sendReports: function() {
var userGr = new GlideRecord('sys_user');
userGr.addActiveQuery();
userGr.query();
var userGroupReports = [];
/*
SAMPLE:
this.userGroupReports = [{
userIds: [],
groupIds: []
}]
*/
var reportId = gs.generateGUID();
var adminReport;
while (userGr.next()) {
var isRotaAdmin = this.ocsNG.rotaAdminAccess(userGr.sys_id + "");
if (!isRotaAdmin || (isRotaAdmin && !adminReport)) {
var userGroupReport = this._buildUserReportData(reportId, userGr.sys_id + "", isRotaAdmin);
if (userGroupReport.groupIds.length) {
userGroupReports.push(userGroupReport);
if (isRotaAdmin) {
adminReport = userGroupReport;
}
}
} else {
adminReport.userIds.push(userGr.sys_id + "");
}
}
this._generateEmailsAndDispatch(reportId, userGroupReports);
this._cacheDeleteReports(reportId);
},


[/code]

This 'sendReports' function is querying for all users in sys_user table and in turn calls 'rotaAdminAccess' function defined in the 'OnCallSecurityNG' script include and passes the user's sys_id as a parameter.

In the out of the box Madrid version, this function looks the user up by the sys_id passed and then checks if that user has 'rota_admin' role.

Revert the Script Include to OOB and then only users with certain roles will be receiving the emails.

Article Information

Last Updated:2019-11-28 12:47:29
Published:2019-11-28