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.

Flow Ask for approval need to create approval only for some users in the approval group

Eli7
Tera Expert

Hi All,

 

I have an approval group with a number of members for different companies within the parent organisation. When a user from company A submits a request an approval is created and a notification is triggered to all members of the approval group.

 

I would like to only create approval records for the approval group members that are in the same company as requester

 

Is there a way to accomplish this?

 

Appreciate any recommendations.

 

1 ACCEPTED SOLUTION

Pravindra1
Tera Guru

Hello @Eli7, You can create a custom Flow Action and place before Ask for Approval activity in Flow, which will take Approval Group and Requested for as an Input.

Pravindra1_0-1683282405449.png

Custom Action Configuration:

Create 2 input Variable as below:

Pravindra1_1-1683282505333.png

- Add a Script Step and create 2 input variable for step, then map Input variable of Action to Step Input Variable.

- in the Script body, write a script to get users from the selected group where Requested for company matches.

- Create an output variable and pass user sys_id array as highlighted below.

Pravindra1_3-1683282616244.png

 

- Create a List type Action output variable and map Step Output to Action Output variable

Pravindra1_4-1683282673964.png

 

Drag and drop output of Action to Ask for Approval approvers field.

Pravindra1_5-1683283096714.png

 

View solution in original post

3 REPLIES 3

Pravindra1
Tera Guru

Hello @Eli7, You can create a custom Flow Action and place before Ask for Approval activity in Flow, which will take Approval Group and Requested for as an Input.

Pravindra1_0-1683282405449.png

Custom Action Configuration:

Create 2 input Variable as below:

Pravindra1_1-1683282505333.png

- Add a Script Step and create 2 input variable for step, then map Input variable of Action to Step Input Variable.

- in the Script body, write a script to get users from the selected group where Requested for company matches.

- Create an output variable and pass user sys_id array as highlighted below.

Pravindra1_3-1683282616244.png

 

- Create a List type Action output variable and map Step Output to Action Output variable

Pravindra1_4-1683282673964.png

 

Drag and drop output of Action to Ask for Approval approvers field.

Pravindra1_5-1683283096714.png

 

Hi Pravindra,

 

It works perfectly  Thanks a ton! 

 

Eli7
Tera Expert

Hi Pravindra,

This is awesome. I will try this and revert!