Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to send multiple group approvals depend upon selected roles (variable type is list collector) by

Khaja Shaik
Tera Contributor

Hi All,

Need help!!

I have a requirement, How to send multiple group approvals depend upon the roles selected from the variable "Roles need" The type of this variable is list collector and may be select one or more roles by using Flow Designer. 

Ex: If user selected 3 roles then have to send group approvals for 3 different groups. 

 

Thanks in advance!!

1 ACCEPTED SOLUTION

Hi @Khaja Shaik 
You can write the scripted approval rule as below in one of flow variables-
ApprovesRejectsAnyG[09745cc9c3302200e7c7d44d81d3ae6f]&AnyG[b8ef24616fc331003b3c498f5d3ee434]

and set this as below

SaurabhGupta_0-1705863883014.png

C

If the provided solution meets your needs, kindly consider marking it as helpful and accepting it as the solution. This helps others who may have similar questions.

 


Thanks and Regards,

Saurabh Gupta

View solution in original post

6 REPLIES 6

Hi Saurabh,

 

Could you pls explain more. i have the same issue and when you say script, could you explain if you mean a script action?

Khaja Shaik
Tera Contributor

Hi @Saurabh Gupta ,

 

Thanks for your answer, it answered my question.

Please find the below script I used in Rule set of "Ask for Approval" action to fulfill my requirement.

 

var grp1 = "64263a0547e3b914952bfc6c736yh6f8"; //sys id of Group 1
var grp2 = "93263a0547e3b914952bfc6c736yh6f8"; //sys id of Group 2
var grp3 = "89263a0547e3b914952bfc6c736yh6f8"; //sys id of Group 3
var grp4 = "47263a0547e3b914952bfc6c736yh6f8"; //sys id of Group 4


var roles = fd_data.trigger.request_item.variables.roles_needed;
if(roles=='role1'){
return "ApprovesRejectsAnyG["+grp1+"]";
}
else if(roles=='role2'){
return "ApprovesRejectsAnyG["+grp2+"]";
}
else if(roles=='role3'){
return "ApprovesRejectsAnyG["+grp3+"]";
}
else if(roles=='role4'){
return "ApprovesRejectsAnyG["+grp4+"]";
}