Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Unanswered

Action 'Apply_to_each' failed

(0) ShareShare
ReportReport
Posted on by 7

Hi 

I have set up a from that allows user a choice of what service they require from us. Do they want to retrieve records from our warehouse or do they want us to collect records to store for them. If they want us to collect records we ask them to attach a template to the form of the records we need to collect.

I have set up a flow where when a form is submitted the data populates a request List (set up in Microsoft Lists) and then there is an action to add the template. All seems to be working well and data is populating the list, however I am getting the above error message when staff select the retrieve option and don't have to attach a template to the request. Is there a way of making the flow just apply this action when collection is selected?

 

Error message

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

 

Thank you 

  • Nived_Nambiar Profile Picture
    17,519 Super User 2025 Season 1 on at
    Re: Action 'Apply_to_each' failed

    Hi @AndyW123 

     

    May be you can use below condition to check whether the dynamic content is null or not?

    Like below :

    Nived_Nambiar_0-1702308785929.png

     

    Hope it helps !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • AndyW123 Profile Picture
    7 on at
    Re: Action 'Apply_to_each' failed

    hi @Nived_Nambiar 

    i think you could be right, my flow is asking to select something every time even though there is no file there every time.  is there a action i can add to correct this?

     

    AndyW123_0-1702284634449.png

     

  • Nived_Nambiar Profile Picture
    17,519 Super User 2025 Season 1 on at
    Re: Action 'Apply_to_each' failed

    Hi @AndyW123 

     

    Show me the dynamic content on which you are looping ?

     

    I think you have to add a condition which checks whether the looping item has null value or not ?

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • AndyW123 Profile Picture
    7 on at
    Re: Action 'Apply_to_each' failed

    Hopefully this is what you were looking for

     

    AndyW123_0-1701968678701.png

     

     

     

     
  • Nived_Nambiar Profile Picture
    17,519 Super User 2025 Season 1 on at
    Re: Action 'Apply_to_each' failed

    Hi @AndyW123 

     

    could you share a screenshot of your flow, that would be helpful 🙂

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • AndyW123 Profile Picture
    7 on at
    Re: Action 'Apply_to_each' failed

    Yes @Nived_Nambiar some data returns through the form will have the template attached and some will not have a template attached.

    It is the ones without the attached template that i am getting the error response on

  • Nived_Nambiar Profile Picture
    17,519 Super User 2025 Season 1 on at
    Re: Action 'Apply_to_each' failed

    Hi @AndyW123 

     

    to be clear, some data is entered in forms with file (template) attached to the form, the flow should create list item for that data entered along with template file attached.

     

    am i right ?

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow