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 / The execution of templ...
Power Automate
Unanswered

The execution of template action 'Apply_to_each' failed

(0) ShareShare
ReportReport
Posted on by 12

I am new to Power Automate.

 

I have a Recurrence flow.  The second step Transforms data using Power Query.  PQ looks at an on-premise SQL table for qualifying records.  If PQ returns any records, an Apply to each step sends an Office email with fields from the records.  I sometimes, not always, get the error:

 

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@outputs('Transform_data_using_Power_Query')?['body/value']' is of type 'Null'. The result must be a valid array.

 

Can you offer any ideas what is happening and how to fix.  Thank you.

Categories:
  • ScottShearer Profile Picture
    25,331 Most Valuable Professional on at

    @generalledger 

    It looks like PQ is not returning any items.  Go to your run and take a look at the output of the PQ action.

     

     

  • generalledger Profile Picture
    12 on at

    It is not unusual for PQ to return with no records.  Is that reason enough for the Flow to crash?  The Flow works sometimes when PQ returns no records.  If no records, Flow should just end.  What should I do when PQ returns no records?  Thank you.

  • ScottShearer Profile Picture
    25,331 Most Valuable Professional on at

    @generalledger 

    You can use the "run after" feature for error handling.  If you want, post a screen shot of your Flow and I can suggest how to configure.

     

     

  • generalledger Profile Picture
    12 on at

    Scott,  thank you.

     

    generalledger_0-1626718158573.png

     

  • ScottShearer Profile Picture
    25,331 Most Valuable Professional on at

    @generalledger 

    I am assuming that there are no additional actions after your apply to each.

    In my example, I just added a compose action - I don't need to do anything here.  I just needed an action so that I could set the run after.

    The compose action will only be hit if the Apply to each fails.  If so, then you Flow will end will success.  I might have added something like a send email action which would notify you that no records were returned instead.

    image.pngimage.png

     

     

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 307 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 127

Last 30 days Overall leaderboard