cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Finding email address based on selected name in Microsoft Form

Hi there,

I am a newbie to MS Power Automate so I hope someone can help me. 

I created a Microsoft Form, and one of the questions provided a list of managers for approval. 

I would like to be able to send an email approval to the manager selected from the list. 
I tried the following using Search for User (V2) but it doesn't work. Can someone help? Many thanks in advance.

 

werdnak_0-1594286100421.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Finding email address based on selected name in Microsoft Form

@werdnak 

I would suggest to add a dummy 'Compose' action block just before 'Send an email', assign as its input the join() based expression, reexecute the flow and inspect its outputs. This way you can verify its result

 

If there is a single email address, then it looks like a provisioning problem on the Azure AD

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

7 REPLIES 7
Highlighted
Dual Super User III
Dual Super User III

Re: Finding email address based on selected name in Microsoft Form

Hi!

'and one of the questions provided a list of managers for approval'

How is this list of managers currently defined in your form? Is it a list of email addresses and the user just picks one, or a list of (first name + sure name), other? Also, did you activated multichoice on the question?

 

If possible, please share a screenshot from 'Get response details' output so we can clearly see what's inside the response

Thanx!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Helper I
Helper I

Re: Finding email address based on selected name in Microsoft Form

Hi @efialttes ,

The list of manager is a drop down list of specified names (e.g. John Doe, Jane Doe). User of the form cannot select multiple names. They can only select one name from the drop down list. 

I provided the outputs below. I highlighted in yellow the name of the manager (based on the selection of the user).

Based on the yellow field, how do I get the email address and put that in the Assigned To field in Start and Wait for an Approval.

Note I also masked the personal information in black.

Thank you so much. 

 

werdnak_0-1594289526975.pngwerdnak_1-1594289615540.png

 

Highlighted
Dual Super User III
Dual Super User III

Re: Finding email address based on selected name in Microsoft Form

Hi!

Just to get sure how is Andrew related info currently stored in your Tenant, do you have its email address? If so, create a manual dummy flow and add 'Get user profile v2' assigning Andrew email address as its input and execute it. This way you can inspect the way personal info is structured on your tenant and figure out why 'Search for users' fails

Hope this makes sense



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Helper I
Helper I

Re: Finding email address based on selected name in Microsoft Form

Hi @efialttes ,

 

There is no issue with Search for Users (V2) function.

 

The issue that I have is I am not sure how to convert the output from Search for Users (V2) -'UserPrincipalName' and put that into the 'Assigned Field' in Start and Wait for an Approval.  I provided the screen shots (both the flow and outputs from Search for Users (V2)) below if you could assist. Many thanks.

 

werdnak_1-1594294742071.png

 

werdnak_2-1594294809582.png

 

Highlighted
Dual Super User III
Dual Super User III

Re: Finding email address based on selected name in Microsoft Form

Hi!

Understood. Two comments:

1.- 'Search for users v2' output is an array of 0..n elements, I believe when executing 'Search for users' you always expect a single match, right?

2.- I am assuming the email address is stored under 'Email' property in each 'Search for users v2' output element, if not just try with UserPrincipalName instead

FLow_SEarchUsers_Approval.png

Please note on Select action block you need to switch input mode (click on the icon on the right)

Now, the WDL expressions inside are:

 

length(body('Search_for_users_(V2)')?['value'])

 

and

 

join(body('Select_MatchingEmails'),';')

 

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Helper I
Helper I

Re: Finding email address based on selected name in Microsoft Form

Hi @efialttes ,

There is only a single match to the Search for Users (V2). 

I still have the same problem as before. Following your guidance, I still receive an error message. Let me show you the flow and outputs. Note that our email address is the same value as the User Principal Name. I tried both and it still returns same error. I suspect that the join(body('Select_3'),';') is returning the following output [s.kong@XXX.edu.au] - with bracket. That is why it cannot find the user - but I don't know how to verify this. 😞

 

Condition 1:  length(body('Search_for_users_(V2)')?['value'])    - No issue here

Select 3:  - No issue here

From : Value

Map: UserPrincipalName: UserPrincipalName

Start and wait for an approval 2: Issue

Assigned To: join(body('Select_3'),';')

 

FlowFlowError OutputError Output

Highlighted
Dual Super User III
Dual Super User III

Re: Finding email address based on selected name in Microsoft Form

@werdnak 

I would suggest to add a dummy 'Compose' action block just before 'Send an email', assign as its input the join() based expression, reexecute the flow and inspect its outputs. This way you can verify its result

 

If there is a single email address, then it looks like a provisioning problem on the Azure AD

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,087)