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"));
}
}
Great article ...Thanks for your great information, the contents are quiet interesting. I will be waiting for your next post.
ReplyDeleteServiceNow Training in Hyderabad
Thanks for sharing valuable information and very well explained. Keep posting.
ReplyDeleteservicenow online training india
servicenow now learning
Too good article,Keep sharing more posts with us.
ReplyDeleteThank you...
ServiceNow Developer Online Training