Using conditions in Flows - different approvers depending on DisplayName result

Occasional Contributor

I have the following flow which gets information for a certain file and requests approval from a set list of approvers as below:


However, I have about 20 different folders where I need to do this from with different approvers required for each folder. For example, users triggering this Flow from FolderA will send an approval to John, while triggering the flow from FolderB will send an approval to Bob.


If Statement.png

I think I can achieve this by getting the DisplayName of the folder by using the Get folder metadata step but then I may need to create 20 different Conditions using the DisplayName.


Is there a simpler, more elegant way for me to achieve this without creating 20 Condition controls?

4 Replies
You could do a switch instead of condition and have the folder value as the switch and then 20 different items. Or what I would do is have a separate list that has the folder mappings. This way it can be controlled and updated in the list instead of having to add or remove from the workflow and save it each time etc.

So you could have two columns. The default title and then add person column and put approved. Have the 20 in there. Then just use “get items” and use a odata filter there. It’s something like “title eq foldername” where foldername is the dynamic folder name from your step. Then it will just return the first item it finds and you can then use the approved from that get items. I think you can wrap it in a first() or some similar expression to return one record so you don’t have to deal with looping on the following steps.

Anyway hope this makes sense. Either method can work. But the list lookup method is a little more dynamic and you can have others easily make updates that way if needed.

@Chris Webb I've tried using Parallel Branch and seems to work but again I'm going to need to create 20 branches.



I've only just started using Flows and am still learning so not sure how to use Switches yet like you've outlined.


Are you saying I can create a List with 2 Column values (Folder Name and Names of Approvers) on my Site and use it as a reference for my Flow?

Yes. I have a pretty complex flow where different categories assign different tasks and it’s all based on a value in a separate list that we use to control the categories and assigned individuals. The flow reads the list on saving a form and sends out tasks etc. dynamically based on the SharePoint list. This way you never have to update the flow to update the logic / assignments of approvers.

I have resolved this by just creating several Parallel Branches with the 20 conditions.