cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
skarthanal
Helper II
Helper II

How to get and create separate variable from an apply to each step

Hi everyone!  What i am trying to accomplish is create 3 variables from an apply to each step in PA.  I have a field in SharePoint that is a people picker which would be a list of approvers.  A user would enter those approvers and in PA i would like to create 3 variables: Approver1,2,3.

 

I have gotten to the point where the apply to each works and returns the 3 people and their email addresses but i am stuck on how to create 3 seperate variables from that apply to each.  I would like to extract the individual email addresses from those 3 approvers and send them seperate emails.  Thanks in advance.

 

flow 1.jpgflow2.jpg

1 REPLY 1
Pstork1
Dual Super User
Dual Super User

Create a string or object array variable to hold the user objects or email strings.  Then use the Append to array action inside the loop to append a new array entry to the end of the variable.  Then you can either use a combination of First(LastN()) or access the array entry directly using JSON notation.  For a string variable called test you would get the second element using this JSON

variables('test')[1]


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (2,040)