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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / "Apply to each" failure
Power Automate
Unanswered

"Apply to each" failure

(3) ShareShare
ReportReport
Posted on by 33

Hello, all!  Power Automate informs me that this is a "new issue" and I should ask the community for help!  I get the following error when I test a flow I've created:

 

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

The purpose of the flow is to send the responses from a Form I created to a pair of other people in my office.  Here's what the flow looks like.  Does anyone have any tips on what I'm doing wrong?  Thanks so much!

 

Space request form flow.png

Categories:
I have the same question (0)
  • Verified answer
    Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @ahhunter 

    try to use 

    array(triggerOutputs()?['body']) instead of body alone.
     
    It will resolve your issue
     
    Mark it as solution if it helps
    Regards,
    Nived N
  • Verified answer
    ahhunter Profile Picture
    33 on at

    This worked - thank you so much!  For other newbies like myself, I had to enter that formula as an Expression rather than as dynamic content.Capture.PNG

  • thanuramarapana Profile Picture
    9 on at

    Thank you. This worked like a charm!

  • fayanan Profile Picture
    2 on at

    Hi @Nived_Nambiar , I have a similar situation but in my case I get this error:
    The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@outputs('Compose')' is of type 'String'. The result must be a valid array.

    In my '@outputs('Compose')', I have this function - base64(outputs('Get_file_content')?['body']). When I try to put this in the "Select an output from previous steps", it returns the above error. Do you have any solutions for this

    ?

    fayanan_0-1659535255860.png

     

  • Community Power Platform Member Profile Picture
    on at

    Hello @ahhunter ,

     

    I have done a double parsing and i am in the same case.

    array(triggerOutputs()?['body']) instead of body alone.

    don't solve my issue ?

     

     

    Can i parse that in one time ? name and link ...

     

    {
    "responder": "greg@contoso.com",
    "submitDate": "11/22/2022 1:39:41 PM",
    "r81ac228c0ac4488fa497a0b3bede58f5": "greg@contoso.com",
    "r65f94823d7e243abbe60ddba96e11acd": "[{\"name\":\"vide_test_greg10.xlsx\",\"link\":\"https://greg0.sharepoint.com/sites/maquette/_layouts/15/Doc.aspx?sourcedoc=%7B6A31120B-E18F-4E58-A45C-FD66D7BFF26E%7D&file=vide_test_greg%2010.xlsx&action=default&mobileredirect=true\",\"id\":\"01OAWIEQQLCIYWVD7BLBHKIXH5M3L374TO\",\"type\":null,\"size\":11437,\"referenceId\":\"01OAWIEQXMK7EZ665IWREJBJA2FLKQLD3Q\",\"driveId\":\"b!Xnzz0OGDD0CVULk8BViOmln6Bpb_GmhLmR21BcHUGr2jC7UuyTjNSKFo8l6OOR3-\",\"status\":1,\"uploadSessionUrl\":null}]",
    "r51b49594923849d8889ed4b141d8b260": "2022-11-30"
    }

     

    My issue is to parse sub-data of r65f94823d7e243abbe60ddba96e11acd.

    In addition, this is a form upload file bydefault.

    Hope that you can help me

     

    Best regards

     

    Grég

  • Community Power Platform Member Profile Picture
    on at

    What was the expression

  • Community Power Platform Member Profile Picture
    on at

    Hi

    The solution just worked on a simelar but very different problem. Thx

  • Jon_vB Profile Picture
    39 on at

    This solution led me in the right direction ... but ... my input was "Run a query against a dataset (Power BI)" ... In the Expression side,I typed "array(  " and then clicked over to Dynamic Content and selected the 'First table of rows'.   This worked!    

     

    It makes sense - treat the first table of rows as an array.  I think either the error message could have been more clear, or the input to an Apply to each Step could have been templated to wrap my input into an Array function.

     

    at any rate - this is my first flow - so, I'm very grateful for this thread getting me in the right direction!  I was pretty close to giving up and doing it with excel macros.

  • UD-10051243-0 Profile Picture
    46 on at

    I'm having a similar error, not sure what I'm doing wrong.

     

    Here is my flow:

    unathid_0-1679302321849.png

     

     

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @unathid 

     

    Write the expression under expressions section

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard