web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get array of al...
Power Automate
Unanswered

How to get array of all elements in a for each loop that cause an error

(0) ShareShare
ReportReport
Posted on by 4

Hey! I currently have a for each loop that iterates over an array of emails. The emails get added to a Microsoft Teams channel.

If one of those emails doesn't get added correctly and throws an error, I would like to get a list of all the emails that don't work so I can manually deal with them. For example,

 

Array = ["email@mail.com", "bad-email@mail.com", "bad-email2@mail.com"]. 

For loop iterates over "email@mail.com", it works. For loop iterates over "bad-email@mail.com", it throws an error. For loop iterates over "bad-email2@mail.com", it throws an error.

 

What I want is to return the array ["bad-email@mail.com", "bad-email2@mail.com"]. This is so I can report it as an error message that those are the emails that need to be dealt with manually.

Categories:
  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    @gbarnholtz 

    Create an array variable named "Bad emails".

    Add a Configure run after setting on the action that errors out.

    Add a parallel branch and append the bad email to the array.

    Configure run after option - Training | Microsoft Learn

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 298 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard