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"));  
}  

}  

3 comments:

  1. Great article ...Thanks for your great information, the contents are quiet interesting. I will be waiting for your next post.
    ServiceNow Training in Hyderabad

    ReplyDelete
  2. Thanks for sharing valuable information and very well explained. Keep posting.

    servicenow online training india
    servicenow now learning

    ReplyDelete
  3. Too good article,Keep sharing more posts with us.
    Thank you...

    ServiceNow Developer Online Training

    ReplyDelete