cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
philipremanuel
Frequent 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. ]

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. ]

Helpful resources

Announcements
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 tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Users online (2,442)