Scripting Approval Rule is throwing error and not working. The Logs are correct ( comma seprated sys ids as expected) but approvals are not triggered. Please help me here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2022 06:41 AM
Hi Guys,
Need to Help to trigger approvals from "Approval Rules" scripting of "Ask for Approval" block of the Flow.
Till Line number 10 ,everything is correct and we are able fetch list of sys_id's which is expected.
No Approvals are seen in RITM's approval sections. Please help where I am missing the script.
Thanks
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2022 06:47 AM
Not entirely tracking your question, are you trying to manually set the approval state/request status? If so, you need to either do ritm.approval = 'state' or ritm.state = # (with 'state' or # corresponding to the approval values in your approval/state tables).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2022 07:06 AM
Hi jc,
No they are not approval values , they are custom user approvals using script in "Approval rule" section of "Ask for Approval" block in Flow.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2022 06:50 AM
Based on your script, it shouldn't be necessary and instead you should be using a look up record action. But to correct your script it should look like the following
var ritm=new GlideRecord('sc_req_item');
ritm.get(fd_data.subflow_inputs.requested_item);
var user_of_manager= ritm.variables.array of_sysid;
return gs.getMessage("ApprovesAnyU[{0}]OrRejectsAnyU[{0}]" , [user_of_manager]);
p.s if you're posting a script on the community, do both the screenshot and the text so it can be easily copied and pasted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2022 07:02 AM
I am getting this error while no approvals generated on RITM approval secttions.