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

shivatmika_19
Tera Guru

Hi @santhoshini2 ,

Could you explain the use case more clearly so that we can help you ?

As your 1) task is understandable but 2) is not clear.

Hi @shivatmika_19 ,

 

1. If anyone raises request approval should go to static approver (XYZ)

2. If static approver itself is the requestor, then approval should go to their manager.

I hope you got the requirement. Please let me know if you need more information.

 

Thanks.

Uncle Rob
Kilo Patron

Ok strap in, because this needs absolutely ZERO code. 
My sample is a service catalog and I'm looking for a requested_for of Abel Tutor.
If that's true I'm sending approval to Abel's manager, otherwise I'm sending to a fixed team.

UncleRob_0-1733230674120.png

 

How do we evaluate if the thing is for Abel Tutor?  In this case we dot walk to the Triggering Record's Requested For.
Since we want to look for a specific user, we paste that user's sys_id into the value.  No single quotes, this isn't a javascript string.  Also, be a good steward of your flow and make sure you annotate who the specific user is, because interpreting and looking up sys_id's makes puppies sad.

UncleRob_1-1733230775079.png

Ok, so if that IF statement evaluates as true lets send to Abel Tutor's manager.  Since the manager may change at any time OR we might change our mind about targeting a specific user, lets make this a rule based, rather than picking another specific approver.  In the case of my RITM example, I'm grabbing the Trigger, RITM, Requested_For, Manager.

UncleRob_2-1733230989026.png

So now lets deal with the Else case.  I don't know what you meant by XYZ, so I assumed a specific group.
So I used the group silhouette icon to select App Engine Admins

UncleRob_3-1733231074349.png

Tested with Abel Tutor, and it successfully went down the true path.

UncleRob_4-1733231160662.png

 

 

 

 

 

Hi @Uncle Rob ,

 

Thank you for your response!

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.

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? If there's a more efficient way to streamline this process, I’d love to hear your suggestions!

Looking forward to your insights. Thank you for helping!