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 / Attachments that go fr...
Power Automate
Answered

Attachments that go from FORMS to SHAREPOINT

(0) ShareShare
ReportReport
Posted on by

Hello, I am looking to have any attachment that is added in FORMS to move over to SharePoint, I already have the form set and the flow was working and works at times but sometimes it fails. Not sure what the issue is can someone please advise, thank you.

 

 

Error message 

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

 

 

BB818U_0-1714188656808.png

BB818U_1-1714190497227.png

 

Categories:
I have the same question (0)
  • Manish Solanki Profile Picture
    15,169 Moderator on at

    Hi @BB818U 

     

    When no attachment is uploaded by a user, the flow fails.

     

    Pls add check for null value using if() function as the input to loop action (Apply to each). Here is the sample:

    if(empty(outputs('Get_response_details')?['body/rca65ac01b82f4df5ad0da612eae33528']),[],json(outputs('Get_response_details')?['body/rca65ac01b82f4df5ad0da612eae33528']))

    pls replace id with actual field id in the above expression.

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

     

  • BB818U Profile Picture
    on at

    Hello how and where do I enter your solution? What steps do I take.

     

    Thank you

  • Manish Solanki Profile Picture
    15,169 Moderator on at

    Hi @BB818U 

     

    In "Apply to each attachment" action, pls replace the json() function with the below expression as its input:

    if(empty(outputs('Get_response_details')?['body/rca65ac01b82f4df5ad0da612eae33528']),[],json(outputs('Get_response_details')?['body/rca65ac01b82f4df5ad0da612eae33528']))

    But you need to replace the field ID with the actual one in the above expression as it is just a sample.

     

     

    Pls retest the flow after replacing the expression in the "Apply to each attachment" action.

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • BB818U Profile Picture
    on at

    I'm getting "THE EXPRESSION IS INVALID" I used your example and updated the field ID, made sure there were no spaces ect. 

  • BB818U Profile Picture
    on at

    I'm getting "THE EXPRESSION IS INVALID" I used your example and updated the field ID, made sure there were no spaces ect. 

  • Manish Solanki Profile Picture
    15,169 Moderator on at

    Pls share the output of get response action from the failed flow instance. I am interested in knowing the values for attachment field in form. You can share the JSON with sample data.

     

     

     

  • BB818U Profile Picture
    on at

    if(empty(outputs('Get_response_details')?['body/r155b0f7dbb6746efbed08000575884de']),[],json(outputs('Get_response_details')?['body/r155b0f7dbb6746efbed08000575884de']))

     

     

    This is what I have I tried to type each but its not working or pasting 

  • BB818U Profile Picture
    on at

    BB818U_0-1717436581128.png

     

  • Manish Solanki Profile Picture
    15,169 Moderator on at

    Please use the below expression:

    if(empty(outputs('Get_response_details')?['body/r155b0f7dbb6746efbed08000575884de']),json('[]'),json(outputs('Get_response_details')?['body/r155b0f7dbb6746efbed08000575884de']))

     

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • BB818U Profile Picture
    on at

    What am I doing wrong here?

     

    BB818U_0-1717513142397.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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 780

#2
Valantis Profile Picture

Valantis 668

#3
Haque Profile Picture

Haque 601

Last 30 days Overall leaderboard