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

Send email for each filtered Array item and output array value

Hi-

 

This Flow will run on a daily schedule checking for items that meet certain criteria and then send an email. I have successfully filtered a SharePoint list using chained filter array activities, I probably could've done this using one filter, but I'm fine with this method unless it is causing the problem. I simply want to loop through the filtered result and send an email for each item in the array outputting one value from the resulting filtered array - the 'Project Name.' Currently, I'm using a static email address as the send to, however once this is functioning I will switch the static email to a value stored in the array- 'Assigned to')

 

Here are the activities I'm performing.

philipremanuel_2-1628084199963.png

I tried forcing it to loop off of the array output 'item' instead of 'body' and then 'item', but that returned blank values for 'project name' and there are no blank values.

 

Here is the result from the screenshot above.

philipremanuel_1-1628084139907.png

I've researched solutions and many of them don't apply to my specific situation or are unnecessarily complex, creating html tables and the like. I would think that looping through a filtered array created from a sharepoint list should be fairly straightforward. Any help would be much appreciated.

 

Thank you

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
tom_riha
Super User
Super User

Hello @philipremanuel ,

when you use the 'Filter array' action you should always loop through the 'Body' dynamic content. That's also what the error message tells you, you can't loop through 'Item' as that's only the current item from the 'Body' = object. Not an array you could loop through.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

Hello @philipremanuel ,

I think the ['Project Name'] is not correct, it should be internal name of the SharePoint column and internal names don't support spaces. The internal name will be something like ProjectName or Project_x0020_Name.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

3 REPLIES 3
tom_riha
Super User
Super User

Hello @philipremanuel ,

when you use the 'Filter array' action you should always loop through the 'Body' dynamic content. That's also what the error message tells you, you can't loop through 'Item' as that's only the current item from the 'Body' = object. Not an array you could loop through.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

Thanks for your response. I made the change to run off of body with a single apply to each. It ran and sent 9 emails which meet the filter criteria as expected. However, the item()?['Project Name'] value displayed as blank when I reviewed the 9 emails. Am I referencing the array incorrectly?

Hello @philipremanuel ,

I think the ['Project Name'] is not correct, it should be internal name of the SharePoint column and internal names don't support spaces. The internal name will be something like ProjectName or Project_x0020_Name.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,512)