Steps to add cancelled condition to Approval User activity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2018 08:41 AM
Need help with adding a cancelled condition to an Approval User activity. I have the completed the following 3 steps but the workflow is not progressing to the Set Values activity even when the Approval User activity has a result of 'cancelled'.
1. Created a cancelled condition in the Approval User activity.
2. modified the condition for approval in the Approval User activity to Wait for : condition based on script with the following script:
if(approvalIDs){
if(approvalIDs['cancelled']){
answer = 'cancelled';
}else if(counts.rejected > 0){
answer = 'rejected';
}else if(counts.approved > 0){
answer = 'approved';
}
}
3. Modified the KMC - Run parent workflows (Approval) business rule to add condition: || current.state.changesTo('cancelled')
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2018 01:15 PM
Maybe try a different condition for approval script on your approval activity? This is the one that I use:
var cax = 0;
var a = new GlideRecord('sysapproval_approver');
a.addQuery('sysapproval',current.sys_id);
a.addQuery('u_approval_level','manager_approval'); //this is a custom field we use because we can do multiple types of approvals and I only want to check the approvals for this level
a.query();
while(a.next()){
if(a.state == 'cancelled'){
cax += 1;
}
}
if (counts.approved > 0){
answer = 'approved';
}
else if (counts.rejected > 0){
answer = 'rejected';
}
else if (counts.total == counts.not_required){
answer = 'not_required';
}
else if (counts.total == cax){
answer = 'cancelled';
}