On call Schedule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 07:31 AM - edited 07-29-2025 07:32 AM
Hi ,
I'm trying to modify the on-call schedule modal in ServiceNow to display the business phone instead of the mobile phone when both numbers are populated in a user's profile. Currently, if both the mobile and business phone fields are filled, the system prioritizes and shows the mobile phone. However, if only the business phone is filled, it displays that instead. Does anyone know where this prioritization logic is set, or how I can modify the modal to show the business phone alongside or instead of the mobile phone
I am trying to overide the script include but it is not working.
OnCallRotationSNC , OnCallRotation
var OnCallRotation = Class.create();
OnCallRotation.prototype = Object.extendsObject(OnCallRotationSNC, {
/**
* Override the _getUsers method to prioritize mobile phone numbers
* @Param {Array} userSysIds - Array of user sys_ids
* @return {Object} users - Object containing user details with mobile numbers prioritized
*/
_getUsers: function(userSysIds) {
if (this._log.atLevel(GSLog.DEBUG))
this.timer.start("[_getUsers]");
var users = {};
if (!userSysIds || userSysIds.length == 0)
return users;
var liveFeedApi;
if (typeof SNC.LiveFeedApi !== 'undefined') // in test project this is not initialized, so keeping null check.
liveFeedApi = new SNC.LiveFeedApi();
var userGr = new GlideRecord('sys_user');
userGr.addQuery('sys_id', 'IN', userSysIds);
userGr.query();
while (userGr.next()) {
var sysId = userGr.getUniqueValue();
var avatarPath = GlideAvatarFinder.getAvatarPath(sysId);
if (avatarPath)
avatarPath = '/' + avatarPath;
// Modified section - Always prioritize mobile phone
var userContactNumber = '';
if (userGr.mobile_phone + '' != '') {
// Always use mobile phone if it exists
userContactNumber = userGr.mobile_phone + '';
} else if (userGr.phone + '' != '') {
// Fall back to business phone only if mobile doesn't exist
userContactNumber = userGr.phone + '';
}
// Continue with the rest of the original function
// (Copy the rest of the _getUsers method from OnCallRotationSNC here)
// If you don't have the full method, at a minimum you need to add the user to the users object
users[sysId] = {
sys_id: sysId,
name: userGr.name + '',
contact: userContactNumber,
avatar: avatarPath
// Include any other properties that the original method includes
};
// If there's more logic in the original method, include it here
}
if (this._log.atLevel(GSLog.DEBUG))
this.timer.end("[_getUsers]");
return users;
},
type: 'OnCallRotation'
});