Flow Designer: Ask for Approval activity getting stuck

Ljone
Giga Contributor

Hi Experts,

Need your help, We have a flow designer created by another developer before me that has activity Ask for approval, now when the approval is updated to No Longer Required, the approval is not moving to the next activity, it gets stuck on Waiting on that Ask for approval activity. But when approval state is approved and rejected, it is working fine.

I am fairly new in using Flow designer and I  am not sure what is the issue, I have pasted our Approval rule below.

Kindly help me resolve. Thank you!!

 

 

*
**Access Flow/Action data using the fd_data object. Script must return a value.
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/
var rec = new GlideRecord('sc_req_item');
rec.addEncodedQuery('request=' + fd_data.trigger.current.sys_id);
rec.query();
var managers = [];
var cc_managers = [];

while(rec.next()) {

if(managers.indexOf(rec.variables.u_manager.sys_id.toString()) < 0)
managers.push(rec.variables.u_manager.sys_id.toString()); 

if(cc_managers.indexOf(rec.variables.u_cost_centre.manager.sys_id.toString()) < 0)
cc_managers.push(rec.variables.u_cost_centre.manager.sys_id.toString()); 
}


var cc_approvers = arr_diff(managers, cc_managers);

function arr_diff (a1, a2) {
var diff = [];

for(var j in a2){
	if(a1.indexOf(a2[j]) < 0){
		diff.push(a2[j]);
	}
}

return diff;
}

//return 'ApprovesAnyU[' + cc_approvers.join(',') + ']OrRejectsAnyU[' + cc_approvers.join(',') + ']';
return 'ApprovesAllU[' + cc_approvers.join(',') + ']OrRejectsAnyU[' + cc_approvers.join(',') + ']';
4 REPLIES 4

Harish KM
Kilo Patron
Kilo Patron

Hi so your setting the approval for No longer required manually? What is the next step after this approval action?

Refer this as well

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0997336

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0814960

https://community.servicenow.com/community?id=community_question&sys_id=5db4b91adbfa945066f1d9d968961916

Regards
Harish

Ljone
Giga Contributor

Hi Harish,

Yes, we are setting it to No Longer Required manually through Approval state  dropdown, there are IF activities per Approval state, if state = No Longer required it would update the approval record, however, when  updated to No Longer required it does not move to that IF activity, it stays in the Ask for approval.

In that case refer the HI link above there is a issue with manual thing, also the other link has a work around where you need to do a lookup record and push forward if approval is set to No longer required.

Regards
Harish

Yamilla Manjko
Tera Guru

Hello! You were able to solve this? We are facing the same problem