cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PhilippM
Regular Visitor

Apply to each - get current user

Hello,

 

Sorry for the german actions in my flow. Hopefully you do understand it anyway.

 

I have an array of names. Then I run an apply to each and look up the names. Afterwards I get some data depending on the name and want to send out an E-Mail and a Teams message.

 

My problem is, whenever I try to use the mail property of the "look up user" action as receiver, flow nests my "send mail" and "send teams chat" action in another apply to each loop. Why is that and is there a way around it?

 

Thank you in advance!

 

My flow

PhilippM_1-1653376377341.png

 

before I add the user principial name

PhilippM_2-1653376722949.png

 

after I add it

PhilippM_3-1653376767054.png

 

 

4 REPLIES 4
Rhiassuring
Super User
Super User

No need to apologize for your German flow actions, but danke anyway 🙂 

If I am understanding right, each person is to receive one message - and you are not trying to send one message to everyone you gather here, correct?

I am not getting the same experience as you are, which makes me wonder 2 things:

Rhiassuring_0-1653432955064.png

 

 

1) How is your "Get User Profile" action configured? Are you asking it for specific fields?

2) What is the "Outputs" that you are Applying-To-Each from?

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



PhilippM
Regular Visitor

Thank you for your reply! Yes exactly, that is what I am trying to achieve. But I am using the "search for user" action and not the "get user profile" one. Maybe this is why it is not creating another loop for you?

 

1) I am using the current element from the array of names --> 2)

PhilippM_0-1653459346388.png

 

2) it is an array of names like this

[

  "surname, name",

  "surname, name",

  "surname, name"

]
 
I actually managed to find a solution, which gives me the current UserPrincipalName without creating another loop.
 
My solution is the following expression. "Benutzersuche" is the "search for user" action.
First(body('Benutzersuche')['value'])['UserPrincipalName']
 
I also found another possible solution here (which I like more), but it doesn't work for me. https://sharepains.com/2020/09/17/unwanted-apply-to-each-power-automate/
If I do understand it right the expression should be:
outputs('Benutzersuche')?['body/UserPrincipalName/Value']

 

Any Ideas why this is not working?

Rhiassuring
Super User
Super User

Try removing the ? from the last one you posted and see if that works for you.

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



PhilippM
Regular Visitor

Unfortunately I get an error from that

PhilippM_0-1653461023379.png

the output from the "search for user" action looks like this

PhilippM_1-1653461163677.png

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,653)