Using conditions in Flows - different approvers depending on DisplayName result

%3CLINGO-SUB%20id%3D%22lingo-sub-1666964%22%20slang%3D%22en-US%22%3EUsing%20conditions%20in%20Flows%20-%20different%20approvers%20depending%20on%20DisplayName%20result%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1666964%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20the%20following%20flow%20which%20gets%20information%20for%20a%20certain%20file%20and%20requests%20approval%20from%20a%20set%20list%20of%20approvers%20as%20below%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20I%20have%20about%2020%20different%20folders%20where%20I%20need%20to%20do%20this%20from%20with%20different%20approvers%20required%20for%20each%20folder.%20For%20example%2C%20users%20triggering%20this%20Flow%20from%20FolderA%20will%20send%20an%20approval%20to%20John%2C%20while%20triggering%20the%20flow%20from%20FolderB%20will%20send%20an%20approval%20to%20Bob.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22If%20Statement.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F218282i205F250E8C5F07E8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22If%20Statement.png%22%20alt%3D%22If%20Statement.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20think%20I%20can%20achieve%20this%20by%20getting%20the%20DisplayName%20of%20the%20folder%20by%20using%20the%20Get%20folder%20metadata%20step%20but%20then%20I%20may%20need%20to%20create%2020%20different%20Conditions%20using%20the%20DisplayName.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Condition.PNG%22%20style%3D%22width%3A%20498px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F218283iF727F9AAB0CED419%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Condition.PNG%22%20alt%3D%22Condition.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EIs%20there%20a%20simpler%2C%20more%20elegant%20way%20for%20me%20to%20achieve%20this%20without%20creating%2020%20Condition%20controls%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1666964%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1667138%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20conditions%20in%20Flows%20-%20different%20approvers%20depending%20on%20DisplayName%20result%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1667138%22%20slang%3D%22en-US%22%3EYou%20could%20do%20a%20switch%20instead%20of%20condition%20and%20have%20the%20folder%20value%20as%20the%20switch%20and%20then%2020%20different%20items.%20Or%20what%20I%20would%20do%20is%20have%20a%20separate%20list%20that%20has%20the%20folder%20mappings.%20This%20way%20it%20can%20be%20controlled%20and%20updated%20in%20the%20list%20instead%20of%20having%20to%20add%20or%20remove%20from%20the%20workflow%20and%20save%20it%20each%20time%20etc.%20%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20you%20could%20have%20two%20columns.%20The%20default%20title%20and%20then%20add%20person%20column%20and%20put%20approved.%20Have%20the%2020%20in%20there.%20Then%20just%20use%20%E2%80%9Cget%20items%E2%80%9D%20and%20use%20a%20odata%20filter%20there.%20It%E2%80%99s%20something%20like%20%E2%80%9Ctitle%20eq%20foldername%E2%80%9D%20where%20foldername%20is%20the%20dynamic%20folder%20name%20from%20your%20step.%20Then%20it%20will%20just%20return%20the%20first%20item%20it%20finds%20and%20you%20can%20then%20use%20the%20approved%20from%20that%20get%20items.%20I%20think%20you%20can%20wrap%20it%20in%20a%20first()%20or%20some%20similar%20expression%20to%20return%20one%20record%20so%20you%20don%E2%80%99t%20have%20to%20deal%20with%20looping%20on%20the%20following%20steps.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EAnyway%20hope%20this%20makes%20sense.%20Either%20method%20can%20work.%20But%20the%20list%20lookup%20method%20is%20a%20little%20more%20dynamic%20and%20you%20can%20have%20others%20easily%20make%20updates%20that%20way%20if%20needed.%3C%2FLINGO-BODY%3E
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.

Condition.PNG

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.

 

Conditions.png

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.