Approval Chains
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2013 08:30 AM
we have a requirement to gather approvals for all managers up to a certain point.
I have tried creating an IF -> Approval User loop in the workflow, but I've noticed two things. 1) the if statement isn't working after the first check, and 2) the approval user activity isn't generating new approvals after the first one. Or it's deleting the previous approvals associated to it.
Any ideas how I should implement this?
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2013 11:29 AM
Can you give a bit more detail and maybe a script sample to help me figure out exactly what you are attempting to do?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2013 01:57 PM
I have fixed the issue with the loop not terminating. The line: answer = ifScript(); is important. I still have a problem with approval records overwriting old ones.
I have a request that needs to be approved by a chain of management (starting with the direct manager) until it reaches some with VIP status.
I have an Approval User workflow which sends an approval to {$requested_for.manager} and has a script which sets
workflow.scratchpad.current_manager = current.requested_for.manager;
The yes path leads to an IF activity with the following Script:
answer = ifScript();
function ifScript(){
var grUser = new GlideRecord('sys_user');
grUser.get(workflow.scratchpad.current_manager);
if (grUser.vip == 'true'){
return 'yes';
}
return 'no';
}
on yes I move along in the workflow. on no I go into an Approval - User with the following script:
var grUser = new GlideRecord('sys_user');
grUser.get(workflow.scratchpad.current_manager);
var answer = [];
answer.push(grUser.manager.user_name);
workflow.scratchpad.current_manager = grUser.manager.sys_id;
on approval, I loop back up to the IF
This works fine except if a manager in the chain approves, that approval record is deleted and replaced with the next approver in the chain, leaving only the final approvers record intact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2013 01:31 PM
I'd love to hear of the solution to this, as I've just tried solving the same problem and discovered the same result (the previous approvals being deleted). Note that the approval history on the task tells us this is the intended behavior:
"Approval history:
User approval for [name] deleted since it no longer matches approval rule [approval object name in workflow].
(names changed to protect the innocent)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2014 03:15 PM
This is exactly what I am trying to do right now. I need to traverse up the management tree and add each manager as an approver only after the previous manager has approved. I need to loop because it is not deterministic to know how many levels to traverse. Meaning I could stop at 3 approvals or 5 depending how many levels of management there are. Also I need to stop at the VIP user. My only issue is on the looping. I do not want the previous approval to be deleted.
It would be great to see a solution here or have an approval activity that will not delete past approvals it has added and only append new approvals.