Skip to main content
Community site session details

Community site session details

Session Id : uS423CgLG5uVr8JSNKIAoN
Power Automate - Using Flows
Unanswered

Action 'Apply_to_each' failed

Like (0) ShareShare
ReportReport
Posted on 7 Dec 2023 14:57:57 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,982 Super User 2025 Season 2 on 11 Dec 2023 at 15:33:19
    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 11 Dec 2023 at 08:52:06
    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,982 Super User 2025 Season 2 on 09 Dec 2023 at 08:52:19
    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 07 Dec 2023 at 17:05:18
    Re: Action 'Apply_to_each' failed

    Hopefully this is what you were looking for

     

    AndyW123_0-1701968678701.png

     

     

     

     
  • Nived_Nambiar Profile Picture
    17,982 Super User 2025 Season 2 on 07 Dec 2023 at 16:26:58
    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 07 Dec 2023 at 15:47:51
    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,982 Super User 2025 Season 2 on 07 Dec 2023 at 15:43:29
    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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Featured topics

Restore a deleted flow
Loading complete