Showing posts with label How to retrieve Requester associated Director email in Service Now ?. Show all posts
Showing posts with label How to retrieve Requester associated Director email in Service Now ?. Show all posts

Wednesday, August 24, 2016

How to retrieve Requester associated Director email in Service Now ?


This blog explains about how to retrieve any requester associated director email Address.

Scenario : Need to assign a specific request to requester associated director for approval

- Below method recursively calls until it finds the 'Director' role for a specific user

var answer=[];  
answer.push(findDirector(current.variables.u_requester.toString()));  //pass the sys_id of user 
function findDirector(id){  
var gr= new GlideRecord("sys_user");  
gr.get(id);  
if(gr.title.indexOf("Director")>-1){    
return gr.getValue('sys_id');  
}  
else{  
return findDirector(gr.getValue("manager"));  
}  

}