
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2017 12:09 PM
if an approval user is inactive approvals should have to trigger for his manager instead of inactive user how to achieve this functionality. i want to achieve this functionality for global applications .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2017 09:16 PM
Hi Pavan,
You may use the below code to find the approver in the management hierarchy if the current user is inactive.
var approver;
var count = 0;
var user = new GlideRecord('sys_user');
user.get('62826bf03710200044e0bfc8bcbe5df1');
if(user.active)
approver = user;
else
approver = getApprover(user, count);
gs.log(approver.name);
function getApprover(user, count){
if(count > 10)
return;
if(user.active)
return user;
else
return getApprover(user.manager, ++count);
}
Hope this helps. Mark the answer as correct/helpful based on impact.
Thanks
Antin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2017 09:16 PM
Hi Pavan,
You may use the below code to find the approver in the management hierarchy if the current user is inactive.
var approver;
var count = 0;
var user = new GlideRecord('sys_user');
user.get('62826bf03710200044e0bfc8bcbe5df1');
if(user.active)
approver = user;
else
approver = getApprover(user, count);
gs.log(approver.name);
function getApprover(user, count){
if(count > 10)
return;
if(user.active)
return user;
else
return getApprover(user.manager, ++count);
}
Hope this helps. Mark the answer as correct/helpful based on impact.
Thanks
Antin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2017 09:26 PM
Please check if this helps.
var user = new GlideRecord('sys_user');
user.get(current.sys_id);
if(user.active)
return user.getValue('user_id');
else
return user.getValue('manager');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 02:07 PM
Hi Pavan
Did you ever got this sorted out? I'm actually stuck with the same issue. Could you please provide the BR for this if you have.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 05:05 PM
Hi Nitin you can use before update business rule on sysapproval table and use srivastav code it would help you and let me know if you still have issues.