Description
When using the Advanced script field to build a list of users or groups approvals in the Approval - User or Approval - Group activity, scripts that return a list of user or group IDs no longer trigger approvals to be created. Returning a list of user or group sys_ids works.
Steps to Reproduce
-
Create a flow on the incident table that contains an Approval - Group activity, and set that activity's Advanced additional approver script to:
answer = [];
answer.push('abraham.lincoln');
answer.push('CAB Approval');You can instead import the attached workflow if desired.
-
Create a new incident that will trigger a flow execution
-
The flow should generate user approvals for Abraham Lincoln and all the members of the CAB approval group.
Workaround
-
Update the two methods in the script include WorkflowApprovalUtils with the following code:
_isValidUser: function(id) { var usr = new GlideRecord("sys_user"); var query = usr.addQuery("sys_id", id); query.addOrCondition("user_name", id); usr.queryNoDomain(); return usr.hasNext(); }, _isValidGroup: function(id) { var ugr = new GlideRecord("sys_user_group"); var query = ugr.addQuery("sys_id", id); query.addOrCondition("name", id); ugr.queryNoDomain(); return ugr.hasNext(); },
-
Remove the related Customer Update [sys_update_xml] record, so that this file will receive future updates.
Related Problem: PRB1244790