- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 06:52 AM
On the ServiceNow portal page the user profile widget has a 'team' widget.
This is reporting on active and non-active users.
This is found here:
1. Go to the portal
2. Click Profile located under the user name
3. The "Team Widget" displays 'my manager', 'My Coworkers' and 'My Direct Reports'
4. 'My Coworkers' and 'My Direct Reports' display both active and non-active (termed) users.
What is needed to change this to only report on active users? We would want to filter on 'locked out' = true.
Thank you,
Rachel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 04:16 PM
Got it, this would be a customisation to 'EP_MyTeamsUtilsSNC' script include.
You would need to add this query to the getTeamMembers and getDirectReports functions
getTeamMembers: function(userGr){
var teamGR = new GlideRecord("sys_user");
teamGR.addActiveQuery();
teamGR.addQuery('locked_out',false);
teamGR.orderBy("name");
teamGR.addQuery("manager", userGr.manager.sys_id);
teamGR.addQuery("sys_id", "!=", userGr.sys_id);
teamGR.addNotNullQuery("manager");
teamGR.query();
return teamGR;
},
/**
* Returns direct reportees of the given user
* @Param {GlideRecord} userGr - GlideRecord of a user
* returns {Array}{GlideRecord}
*/
getDirectReports: function(userGr){
var directReportGR = new GlideRecord("sys_user");
directReportGR.addActiveQuery();
directReportGR.addQuery('locked_out',false);
directReportGR.orderBy("name");
directReportGR.addQuery("manager", userGr.sys_id);
directReportGR.query();
return directReportGR;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 04:16 PM
Got it, this would be a customisation to 'EP_MyTeamsUtilsSNC' script include.
You would need to add this query to the getTeamMembers and getDirectReports functions
getTeamMembers: function(userGr){
var teamGR = new GlideRecord("sys_user");
teamGR.addActiveQuery();
teamGR.addQuery('locked_out',false);
teamGR.orderBy("name");
teamGR.addQuery("manager", userGr.manager.sys_id);
teamGR.addQuery("sys_id", "!=", userGr.sys_id);
teamGR.addNotNullQuery("manager");
teamGR.query();
return teamGR;
},
/**
* Returns direct reportees of the given user
* @Param {GlideRecord} userGr - GlideRecord of a user
* returns {Array}{GlideRecord}
*/
getDirectReports: function(userGr){
var directReportGR = new GlideRecord("sys_user");
directReportGR.addActiveQuery();
directReportGR.addQuery('locked_out',false);
directReportGR.orderBy("name");
directReportGR.addQuery("manager", userGr.sys_id);
directReportGR.query();
return directReportGR;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 08:04 AM
Thank you
This line of code is what I was missing
teamGR.addQuery('locked_out',false);