Counting Approvals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2015 01:01 PM
Hello Community,
I'm trying to count the amount of approvals that i've gained on a specific record. I've noticed a gap in functionality and I want to see if anyone else has experienced this or might know a way around it. So here it is...
I'm not actually concerned with how many approvals or rejections that I get. I am actually going to be running 2 separate workflows on the same Request.Workflow A contains an approval activity that generates 5 approvals. At the end of Workflow B I will be running a Run Script activity that sets those 5 approvals from Workflow A to 'No Longer Required'. Here is where the problem comes in...
The reason I am running that Run Script activity at the end of Workflow B is because I want Workflow A to respond to Workflow B ending. In order for this to work correctly, I need the approval activity in Workflow A to recognize that all of the approvals are no longer required and proceed to the next activity. What I have noticed is that even when I use the following script to count the approvals, it only runs when I get an approval or rejection. It does not run when I set an approval to 'No Longer Required'.
for (var id in groups) {
var group = groups[id];
}
var total = groups[id].total;
gs.log("TOTAL : " + total);
var notNeeded = groups[id].not_required;
gs.log("NOT REQUIRED : " + notNeeded);
if(notNeeded == total){
answer = 'not_required';
gs.log("ALL APPROVALS NO LONGER REQUIRED");
}
So, does anyone know a way for me to acknowledge that all of the approvals have been set to 'No Longer Required' and make the workflow continue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2015 01:48 PM
Kenneth,
There is a business rule on Approval table 'SNC - Run parent workflows (Approval)', mimic the same business rule when the State is changed to No Longer Required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2015 02:24 PM
Thanks for the assist. So that portion works but even when I set all of the approvals as 'No Longer Required', the workflow approval activity still results to "approved". I even added a condition with activity.result == 'not_required' and it still always defaults to 'approved'. Any ideas?