cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bluelemon247
Frequent Visitor

Nesting Conditions - have reached maximum nested conditions - how to create better if Functions?

Hello All,

 

Currently part of my flow reads like this:

Condition 1: if Managers name = Person A

Yes - Person A ID No - Condition 2: if Managers name = Person B

                             Yes - Person B ID / No - Condition 3: if Managers Name = Person C

                                                            Yes - Person C ID / No - Condition 4 etc....

Please see picture attached for better visual 

Is there a way of creating a list of options in a 'set variable' for all so that if A is selected it knows to use person A ID?

Or just a better way of tidying this flow up to future proof it a bit incase multiple people need adding

 

Thank you in advance 🙂

Screenshot 2022-04-13 at 14.11.46.png

 

 

                              

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @bluelemon247,

 

You could create an array with the mapping of Manager name and the related id. You could use your input to filter the array and find the correct related person id.

 

Below is an example of that approach.

 

This could be the array.

[
{
"ManagerName": "Person A", 
"ID": "Person A ID"
},
{
"ManagerName": "Person B", 
"ID": "Person B ID"
},
{
"ManagerName": "Person C", 
"ID": "Person C ID"
}
]

 

This would be the expression in the set variable which retrieves the id of the first (and I assume only) item it found after filtering:

first(body('Filter_array'))['ID']

arraywithmapping.png

View solution in original post

2 REPLIES 2
Expiscornovus
Super User
Super User

Hi @bluelemon247,

 

You could create an array with the mapping of Manager name and the related id. You could use your input to filter the array and find the correct related person id.

 

Below is an example of that approach.

 

This could be the array.

[
{
"ManagerName": "Person A", 
"ID": "Person A ID"
},
{
"ManagerName": "Person B", 
"ID": "Person B ID"
},
{
"ManagerName": "Person C", 
"ID": "Person C ID"
}
]

 

This would be the expression in the set variable which retrieves the id of the first (and I assume only) item it found after filtering:

first(body('Filter_array'))['ID']

arraywithmapping.png

bluelemon247
Frequent Visitor

Thank you @Expiscornovus massive help - all sorted now 

 

I dont suppose you would know anything about another issue i'm having - I'm getting an 'invalid URL value' error - 

Invalid URL value.

A URL field contains invalid data. Please check the value and try again.
clientRequestId: 449d2f9c-4e3d-4550-900f-018d295f7437
serviceRequestId: 449d2f9c-4e3d-4550-900f-018d295f7437

 

Which basically means that the URL is too long to process - is there a way round this? 

 

Thank you again for your help above - been working on trying to get that flow to work for ages!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,375)