How to Dynamically Assign Approvers in Flow Designer Based on Requestor Logic?

santhoshini2
Tera Contributor

Hi Community,

I am currently working on a flow in Flow Designer that needs to dynamically assign approvers based on the requestor. The use case is as follows:

  1. If a specific user (e.g., "XYZ") raises a request, the approval should go to her manager.
  2. If anyone else raises a request, the approval should go to XYZ.

I’ve attempted to implement this using the "Ask for Approval" action, but I am struggling to configure the dynamic assignment of approvers using scripts. 

Can anyone suggest the approach to achieve this functionality?

I appreciate any guidance or examples from the community to help me resolve this issue. Thanks in advance for your help!

 

1 ACCEPTED SOLUTION

Hi @santhoshini2

You can try this approach: 

 

Screenshot 2024-12-04 at 12.20.01 PM.png

Inside if:

Screenshot 2024-12-04 at 12.21.07 PM.png

for this step you need to create flow variable from (...) of flow designer and give the type of the flow variable as reference and select User table

Screenshot 2024-12-04 at 12.22.17 PM.png

else case (when any user other than static user approval goes to static user)

Screenshot 2024-12-04 at 12.23.46 PM.png

The last step outside if's: Ask for approval:

Drag the flow variable to the rules.

Screenshot 2024-12-04 at 12.24.51 PM.png

 

 

Complete Flow:

Screenshot 2024-12-04 at 12.26.21 PM.png

 

Note: you need to handle a case where static user doesn't have any approver.

View solution in original post

7 REPLIES 7

I completely agree with you that by following this method, I would need to check the approval status twice to update the catalog tasks and RITMs. This adds additional steps to the process and might complicate the flow.

I don't understand what this means.  You're not checking approval status twice, you're resolving an If and creating ONLY ONE of two different types of approval.

 

Is there any way we can achieve this functionality using a single "Ask for Approval" action while still dynamically determining the approvers based on the requestor?

You *could* script it, but in so doing you're eliminating two key benefits of the flow
- ease of troubleshooting
- ease of reading.

Hi @santhoshini2

You can try this approach: 

 

Screenshot 2024-12-04 at 12.20.01 PM.png

Inside if:

Screenshot 2024-12-04 at 12.21.07 PM.png

for this step you need to create flow variable from (...) of flow designer and give the type of the flow variable as reference and select User table

Screenshot 2024-12-04 at 12.22.17 PM.png

else case (when any user other than static user approval goes to static user)

Screenshot 2024-12-04 at 12.23.46 PM.png

The last step outside if's: Ask for approval:

Drag the flow variable to the rules.

Screenshot 2024-12-04 at 12.24.51 PM.png

 

 

Complete Flow:

Screenshot 2024-12-04 at 12.26.21 PM.png

 

Note: you need to handle a case where static user doesn't have any approver.

Thank you so much for your help! @shivatmika_19 

Your solution perfectly addresses my requirement, and I truly appreciate the time and effort you put into explaining it. It has not only resolved my issue but also helped me better understand the flow design process in ServiceNow.

Thanks again for your support and guidance—this community is amazing because of contributors like you! 😊