Flow designer scripted approvals not working

Priya75
Tera Contributor

Hi All,

 

I am creating a flow for a table(x_nose_ap_infringemnet) , so i have kept the trigger point :-when the approval field is changed to Approval after this i am sending the record sys_id to action which is taking input as sys_id and it is calling a script include from there and sending back the approval group sys_id..it could be multiple or single. 

 

Action (called after trigger)

var record=inputs.a2precord; //sys_id from flow 

var group = [];

var getApp = new Infg_AprrovalMatrix();

group = getApp.getApprovals(record);

output.approvalList="ApprovesRejectsAnyG["+group+"]" //also getting the sys_id from the script include

 

 

the Approval is generated but the approval doesn't wait for approval or rejection . the Ask for approval output shows :- state as skipped. how can i make it wait for it? WhatsApp Image 2025-12-02 at 19.30.41.jpeg

 

 

 

 

9 REPLIES 9

Jennifer Metz
Giga Guru

Hello @Priya75,

 

It's hard for me to assess the issue without seeing any logs or records. The ask for approval action waits before moving forward. It sounds like it is skipping because there were no approvers. I would check the logs to see what approvers were returned. If you are unable to see in the logs, then create some log messages in your script include and see what is being return.

 

Hope this helps!

 

Jennifer Metz
Sr. ServiceNow Developer | Infosys

1.jpeg2.jpeg3.jpeg4.jpeg5.jpeg

@Priya75 The flow logs clearly indicate the warning 'Skipped due to no valid approvers'. I recommend you to check your users in the group again. Also, please check the output of the line 

group = getApp.getApprovals(record); and see if this returns a valid group sys_id.

Hi ,

users were active, i have changes the way it returns the output .it worked i return this from script include "ApprovesRejectsAnyG["+group+"]" and it is now generating the approval but i have another problem this gives output as approval status=approved if the approval is approved after that i have used "IF" which is evaluating to true but after that if i use Update record , it is giving me error.