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-25-2018 09:12 AM
You should find the solution in below thread
Approval not following cancelled output
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2018 09:36 AM
Thank you for the response.
I had already followed the steps in the article. The one change I made in the workflow is in the 'wait for condition' script to use the following log statement as suggested in the article.
gs.log(' total: ' + counts.total + '\napproved: ' + counts.approved + '\nrejected: ' + counts.rejected + '\nrequested: ' + counts.requested + '\nnot_requested: ' + counts.not_requested + '\nnot_required: ' + counts.not_required);
and the log output is:
total: 1
approved: 0
rejected: 0
requested: 1
not_requested: 0
not_required: 0
I am not sure how but the count is set for requested to 1 and I don't see cancelled here. I was checking for approval to be cancelled but now wondering if it should be changed to requested but why?
if(approvalIDs){
if(approvalIDs['cancelled']){
answer = 'cancelled';
}else if(counts.rejected > 0){
answer = 'rejected';
}else if(counts.approved > 0){
answer = 'approved';
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2018 10:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2018 06:47 AM
Yes, I have added the condition to the Business Rule and also logging the current.state. The bus. rule is getting executed. The result of the Approval activity is getting set to cancelled. But the workflow is not progressing to the next step. I have followed every step mentioned in this article: https://old.wiki/index.php/Custom_Transitions_for_the_Approval_-_User_Activity but with no luck so far.