Approval Rejection is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2023 07:08 AM
Hi All,
Having a requirement triggering a multiple approval and after approvals task provision.
for that we tried using flow designer and workflow in flow designer we were using common subflow for manager approval after that tried to use the workflow for multiple approvals after approvals finally task provision.
But in the rejection case the workflow is not working as expected(if all the approvals are rejected it should return reject value. but its getting approved value and triggering task.
Wait Condition :
checkApproval();
function checkApproval() {
var grTask = new GlideRecord('sysapproval_approver');
grTask.addQuery('sysapproval', current.sys_id);
grTask.addQuery('state','requested');
grTask.query();
if(grTask.hasNext()){
answer = false;
}
else{
answer = true;
}
}
If condition :
answer = ifScript();
function ifScript() {
var app_count = 0;
var approval = new GlideRecord("sysapproval_approver");
approval.addQuery('sysapproval='+ current.sys_id +'^state=rejected');
approval.query();
var app_count = approval.getRowCount();
if(app_count == 😎 {
return 'yes';
}
else {
return 'no';
}
}
Need suggestion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2023 07:27 AM
@Community Alums
so you want to wait till all approvals are rejected?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2023 07:35 AM
if the triggered all approvals are rejected then it should pass value Rejected.
But in current workflow its returning approved at the end and triggering the task. even if the approvals are rejected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2023 07:43 AM
@Community Alums
Would you mind closing your earlier questions by marking appropriate response as correct so that it helps future readers?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2023 11:53 PM
Any suggestion on this current workflow execution.
after subflow manager approval we used a workflow for multiple option selection group approvals.
if Script :
answer = ifScript();
function ifScript() {
var app_count = 0;
var approval = new GlideRecord("sysapproval_approver");
approval.addQuery('sysapproval='+ current.sys_id +'^state=rejected');
approval.query();
var app_count = approval.getRowCount();
if(app_count == 10) {
return 'yes';
}
else {
return 'no';
}
}
through this script it returning value approved. because the manager approval is considering as approved, hence triggering the task.
it should not be.
only the group approvals need to check based on that approval it should return value.