VIP Approval in the Requested for in workflow
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2025 08:27 AM
I want to configure dynamic approvals in a workflow by finding the VIP user within the Requested for organization's hierarchy. The VIP field is present in the user table and is set to true for both managers and their managers. VIP approval is the third level of approval in the chain, which follows this order: Requested for → Manager approval → Group approval → VIP approval.
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2025 09:02 AM
How confident are we in the quality in the data? You can write a recursive function (example below) to walk the hierarchy but you need consider:
- What's if a manager isn't set to VIP true
- What's if there is no manager populated
- What's if <some other data issue>
var walkVIPManager = function(user, recursionLimit) {
if(recursionLimit == 0)
return user;
if (user.manager.nil())
return;
var managerGR = user.manager.getRefRecord();
if (!managerGR.isValidRecord())
return user; //may want to return null instead and error handle
if (JSUtil.getBooleanValue(managerGR, 'vip') == false)
return user; //may want to return null instead and error handle
return walkVIPManager(managerGR, recursionLimit - 1);
}
var approvingUser = walkVIPManager(user /**the requestefor GlideRecord */, 3 /** Limit of how many recursions we do */)