custom approval in flow designer

Deepika54
Tera Contributor

Hello experts, 

 

I am creating a flow designer in which in the output variable, i have comma seperated user's sysid's example

 
["904aa11993c322909fa4d2fbb9373c16","24206a0f93792e105f36bb697bba102a"]
I want to send an approval to all of the users that will be there in the output of the action which will hold the sysid's.
Can anyone tell me how to pass these values in the ask for approval in flow designer
2 ACCEPTED SOLUTIONS

Utpal Dutta
Tera Guru

Hi @Deepika54 ,

I think you've created a custom action from flow designer. In this case why don't you return output as list reference type rather than string so you can use it directly in your main flow where you're using "Ask approval" activity.

 

Please follow below steps to modify your action output:

  1. Set output variable in script action as list reference to user table.UtpalDutta_6-1767965471646.png

     

  2. In output create output variable of type list     again.UtpalDutta_3-1767964649822.png
  3. Click on exit edit mode and then set your output variable value with script step output value.UtpalDutta_4-1767964720796.png

 

Once your action is setup then go back to your main flow and use above action output directly in your approval action like below:

UtpalDutta_7-1767965607047.png

 

 

 

Above solution will also work if you're using a subflow which is returning comma seperated string.

 

If my answer helps then please mark it helpful & accept this solution.

 

Thanks,

Utpal

 

View solution in original post

@Deepika54 

Thank you for marking my response as helpful.

As per new community feature you can mark multiple responses as correct.

💡 If my response helped, please mark it as correct as well so that this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Afrith Shariff
Tera Guru

Hi @Deepika54 ,

 

The script field needs you to return a string that is created based on the syntax below. In my case, the approval will be approved or rejected if any users from that string of users will approve or reject. I'm using my flow variable and concatenate the list of sys_ids into the return string. 

image.png

 

This is the different options available for you to use in Script.

 

ApprovalScript
Approved by any UserApprovesAnyU[user_sys_id,user_sys_id]
Approved by 50% of GroupApproves50%G[group_sys_id]
Approved by 2 of Users or of GroupApproves2#U[user_sys_id,user_sys_id]G[group_sys_id]
Rejected by all UsersRejectsAllU[user_sys_id,user_sys_id]
Rejected by any user in GroupRejectsAnyG[group_sys_id,group_sys_id]
Approved or Rejected by any UserApprovesRejectsAnyU[user_sys_id]
Approved by Group or Rejected by any UserApprovesAnyG[group_sys_id]OrRejectsAnyU[user_sys_id]
All responded and anyone approves in GroupApprovesResG[group_sys_id]

 

Thanks,

Afrith

"If you feel this was helpful, Please mark this comment as helpful"

Utpal Dutta
Tera Guru

Hi @Deepika54 ,

I think you've created a custom action from flow designer. In this case why don't you return output as list reference type rather than string so you can use it directly in your main flow where you're using "Ask approval" activity.

 

Please follow below steps to modify your action output:

  1. Set output variable in script action as list reference to user table.UtpalDutta_6-1767965471646.png

     

  2. In output create output variable of type list     again.UtpalDutta_3-1767964649822.png
  3. Click on exit edit mode and then set your output variable value with script step output value.UtpalDutta_4-1767964720796.png

 

Once your action is setup then go back to your main flow and use above action output directly in your approval action like below:

UtpalDutta_7-1767965607047.png

 

 

 

Above solution will also work if you're using a subflow which is returning comma seperated string.

 

If my answer helps then please mark it helpful & accept this solution.

 

Thanks,

Utpal