Need to pass group member's sys id in Ask for approval Action

banani1
Tera Contributor

I have a custom action where i am fetching group member's sys id in an array .

For Example :  ["84ffde55db78ef0001b2b5ca68961930","ad6749e61bd0c5d4e5044221b24bcbab"]

 

Now I need to pass it to my main flow " Ask for approval" action

when I am trying to do it getting an error like 

2024-11-19 03:59:29Warningparsing error:
2024-11-19 03:59:29WarningSkipping approvals due to invalid rule: 
 
banani1_0-1731989057111.png

 

 
And I want the output like anyone from the group can approve or reject.
Could anyone one please help me out.
 
Thanks in advance,
Banani

 

3 REPLIES 3

Akash4
Kilo Sage
Kilo Sage

Hi Banani,

Group member sysIDs are not exactly User SysIDs, you may need to script to get users from the array.

Use a script step in your flow with:

var approvers = [];
var groupMembers = ["84ffde55db78ef0001b2b5ca68961930", "ad6749e61bd0c5d4e5044221b24bcbab"];
groupMembers.forEach(function(memberId) {
approvers.push({sys_id: memberId});
});
outputs.approvers = approvers;

 

Secondly, ensure in Ask for Apprpval step that Approval rule is set to Anyone can Approve or Reject

 

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.

Runjay Patel
Giga Sage

Hi @banani1 ,

 

Why are you fetching group members through script, you can set that group in ask for approval using configuration. 

You should avoid writing script if configuration is available to achieve your goal. or let me know your business requirement, based on that i will suggest you best solution.

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

GarrettCh
Tera Expert

This issue is related to PRB1813296. The problem is in relation to a group approval, but is the same error just for the user you are sending the approval to.