Skip to content

Commit 01437e7

Browse files
Create Yser where Manager is Empty.js
1 parent 69c730d commit 01437e7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(function() {
2+
var users = [];
3+
var userGr = new GlideRecord('sys_user'); // used different variable name instead of gr.
4+
userGr.addActiveQuery(); // only active users
5+
userGr.addNullQuery('manager'); // users with no manager
6+
userGr.query();
7+
8+
var count = 0; // Initialize count
9+
10+
while (userGr.next()) {
11+
// Include Sys ID along with display name
12+
users.push('\n' + userGr.getDisplayValue() + ' (Sys ID: ' + userGr.getUniqueValue() + ')');
13+
count++; // Increment count
14+
}
15+
16+
gs.info("Users without manager are: " + users.join(''));
17+
gs.info("Total users without manager: " + count);
18+
})();

0 commit comments

Comments
 (0)