File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Client-Side Components/UI Actions/Show Direct Reports Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ This script should be placed in the UI action on the table sys_user context menu .
3+ client is unchecked
4+ */
5+
6+
7+ try {
8+
9+ var user = new GlideRecord ( 'sys_user' ) ;
10+ user . addQuery ( 'active' , true ) ;
11+ user . addQuery ( 'manager' , current . getUniqueValue ( ) ) ;
12+ user . query ( ) ;
13+ var count = user . getRowCount ( ) ;
14+ if ( count == 0 ) {
15+
16+ gs . addInfoMessage ( 'No Direct Reports found for the user.' ) ;
17+ } else {
18+ gs . addInfoMessage ( count + ' Direct Reports found for the user.' ) ;
19+ }
20+ action . setRedirectURL ( 'sys_user_list.do?sysparm_query=active!=false^manager=' + current . getUniqueValue ( ) ) ; // //Redirects to the list view
21+
22+ } catch ( e ) {
23+ gs . addErrorMessage ( 'Failed in showing direct reportees ' + e ) ;
24+ }
You can’t perform that action at this time.
0 commit comments