cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rsymmons
Resolver I
Resolver I

Form response to match value in list then add email from second column to approver

Hi,

 

I'm trying to create a flow whereby a form is filled in, and depending on the country select in a drop down, that will then match to a row in a list e.g. Selecting UK from the drop down on the form will match to the UK row in a list and then take the email address from the second column in that row and add it to the approvers section in an approval workflow. 

 

I can use several branches of conditions in parallel to achieve this but surely there is a more dynamic way of selecting a country from a form drop down and adding the relevant individual from that location as an approver. 

 

Help 🙂 !!

1 ACCEPTED SOLUTION

Accepted Solutions

This is what I've done:

 

rsymmons_1-1618476675321.png

rsymmons_2-1618476762098.png

 

View solution in original post

4 REPLIES 4
Expiscornovus
Super User
Super User

Hi @rsymmons,

 

One approach could be to create an array in your flow with the mappings of countries and email addresses and filter that array based on the response in the form.

 

Below is an example of that.

 

1. Add a compose action. Use a mapping like below.

[
  {
    "Country": "UK",
    "Email": "uk@contoso.onmicrosoft.com"
  },
  {
    "Country": "Netherlands",
    "Email": "nld@contoso.onmicrosoft.com"
  },
  {
    "Country": "Belgium",
    "Email": "blg@contoso.onmicrosoft.com"
  }
]

composecountrymapping.png

 

2. Add a parse json action. Use the outputs of the previous compose as content. I used the following schema

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Country": {
                "type": "string"
            },
            "Email": {
                "type": "string"
            }
        },
        "required": [
            "Country",
            "Email"
        ]
    }
}

 

parsejson_countrymapping.png 

 

3. Add a filter array action. Use the Outputs of the Parse Json for the From field. Compare the Question with the Country value. This should result in only one row with the correct email.

 

filterarray_countrymapping.png

 

4. Add a compose action and add the following expression. Obviously you can use this expression also directly in other actions. This is just an example.

body('Filter_array')[0]['Email']

 

emailexpression.png

 

Hi @Expiscornovus,

 

I've managed to find a solution to my flow, I ended up using a filter query on a get items action to a SP list and then used a variable to pull the email address from there. Just means I can have something a bit more user friendly for staff to update and manage country contacts 🙂 

 

Your compose and parse action is very useful though so will definitely use this in future!

This is what I've done:

 

rsymmons_1-1618476675321.png

rsymmons_2-1618476762098.png

 

View solution in original post

Yes, a filter query is also a good option 😃. Nice job on fixing it yourself 🙂

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,340)