File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Client-Side Components/Client Scripts/Auto-Add Watch List Based on Caller Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ var WatchListHelper = Class . create ( ) ;
2+ WatchListHelper . prototype = Object . extendsObject ( AbstractAjaxProcessor , {
3+
4+ getWatchListByCaller : function ( ) {
5+ var callerId = this . getParameter ( 'sysparm_caller' ) ;
6+ var watchListSysIds = [ ] ;
7+ var userGR = new GlideRecord ( 'sys_user' ) ;
8+ if ( userGR . get ( callerId ) && userGR . department ) {
9+ // Fetch department managers
10+ var dept = new GlideRecord ( 'cmn_department' ) ;
11+ if ( dept . get ( userGR . department ) ) {
12+ if ( dept . manager )
13+ watchListSysIds . push ( dept . manager . sys_id . toString ( ) ) ;
14+ }
15+ }
16+ // Return as comma separated string
17+ return watchListSysIds . join ( ',' ) ;
18+ } ,
19+
20+ type : 'WatchListHelper'
21+ } ) ;
You can’t perform that action at this time.
0 commit comments