Hello,
In my flow, I create an array (ManagerEmails) using Initialize Variable. Then, I have a ForEach loop that appends email into the ManagerEmails array. After the first ForEach loop finishes, I have another ForEach loop that loops through the ManagerEmails array variable. How do I access the elements of the ManagerEmails array
Solved! Go to Solution.
ok, based on your suggestion, I think I figured it out. For those who wondered, instead of appending the email directly to the array variable, I write an expression using concat which concatinate the email with an empty string. Somehow it works. The expression I used was
concat(items('Apply_to_each')?['Manager']?['Email'],'')
Hi @uyentpk,
What’s the type of the variable? Have you set it as String?
In the following flow, I set the variable type as String, and I can select the variable for the To field of the Send an email action.
Please check the following screenshot for a reference:
Best regards,
Mabel Mao
Hi @v-yamao-msft,
The type of my variable is an array. Then, in the first apply to each, I append the email of each manager to the array variable I have. The manager is a person or group field in SharePoint.
In your example, I see that you set your variable to String. Is there anyway that I can make the array understand the values I append to it are string because I want to make a list of emails. Please see my screenshots for more details. Thank you for your help 🙂
ok, based on your suggestion, I think I figured it out. For those who wondered, instead of appending the email directly to the array variable, I write an expression using concat which concatinate the email with an empty string. Somehow it works. The expression I used was
concat(items('Apply_to_each')?['Manager']?['Email'],'')
Hi @uyentpk,
Thanks for sharing. I am glad to hear that you figured it out.
Best regards,
Mabel Mao
HI @uyentpk,
Why don't you use the select action to transform the data?
Here is an example:
https://veenstra.me.uk/2018/06/04/microsoft-flow-how-to-make-your-flows-perform-better/
Hello, @uyentpk!
Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @Pieter_Veenstra‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!
Thank you for being an active member of the Flow Community!
-Gabriel
Flow Community Manager
I found the solution in this post to work really well. Except that I feel Power Automate should simply be able to iterate over one of its own arrays.
Looping through an Array in Power Automate – Mrs Toni Gee (tkg.nz)
The solution is simple though: Parse the array as JSON first.