Skip to content

Commit b654255

Browse files
authored
Create getManagerInfo.js
This script include helps the developers to retrieve the manager and manager's manager sys_id so that they can utilize in their client script for further usage.
1 parent 39fdcf8 commit b654255

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+
var ManagerInfo = Class.create();
2+
ManagerInfo.prototype = Object.extendsObject(AbstractAjaxProcessor, {
3+
4+
getManagerInfo: function(){
5+
var usr=this.getParameter("sysparm_user_sys_id"); //getting the logged in user's sysid from the client script
6+
var obj={}; //JSON object
7+
var gr= new GlideRecord("sys_user"); //gliding over user table
8+
gr.addQuery("sys_id",usr);
9+
gr.query();
10+
if(gr.next()){
11+
obj.managr1=gr.manager.toString(); //getting immediate manager's sys_id and storing in json object
12+
obj.managr2=gr.manager.manager.toString(); //getting skip level manager's sysid and storing in json object
13+
}
14+
15+
return JSON.stringify(obj); //returning the object to client script for further usage
16+
},
17+
type: 'ManagerInfo'
18+
});

0 commit comments

Comments
 (0)