Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Triggers
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
  • Get help with flow
Menu

How to handle MS Forms with no attachments in Power Automate

Posted on August 31, 2022August 31, 2022 by Tom

“My Power Automate flow fails when users don’t upload an attachment, how do I modify it to save Forms data even when there’re no attachments?”


You can collect various pieces of information via Microsoft Forms. You can ask users on multiple types of questions, and you can even ask them to upload a file. While storing the answers to questions is quite straightforward, it’s not so with the attachments. Especially if the attachments are optional.

Users upload an attachment, and your flow works fine. But once there’s no attachment, the flow ends with an error. Why? What should the flow look like to handle both situations?

Why is it a problem?

Before you try to process the attachment(s), check the actual output from MS Forms. Send a response with an attachment to see it in the response body.

On the other side, response without an attachment has the “attachments question” empty.

And that’s the problem. If you follow many of the guides, you probably use the ‘Parse JSON’ action which causes the flow errors. It expects an input in the defined schema, and if there’s no input it fails – ‘Required property ‘content’ expects a value but got null. Path ”.’.

Just add a condition

The solution is very simple – just add a ‘Condition’. Check if the attachments dynamic content is not equal to “” (the value you can see on the screenshot with empty attachment). If it’s not equal to “”, save the attached file, otherwise do nothing.

Power Automate forms no attachments

Summary

When a Power Automate flow tells you that it received ‘null’ and fails, as when there’re no attachments in Forms, you can just add a ‘Condition’ to check the value before you try to use it. Check the output of the action when it’s empty, compare it with the correct empty value, and skip some actions if it’s true/false. There’s no need to think about complex solutions when all you need is a simple ‘Condition’.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

3 thoughts on “How to handle MS Forms with no attachments in Power Automate”

  1. Kojo A says:
    October 7, 2022 at 2:24 pm

    Amazing help! Was racking my brain this morning trying to figure it out.

    Thanks

    Reply
  2. elbbubria12 says:
    December 8, 2022 at 9:17 pm

    Help Please? I have tried to handle the same error when there’s no attachment, but I’m attempting to send an email to a group with / without the uploaded file(s). In the “Yes” side of the condition, when attempting to Initialize the attachment Variable (which I understand to be required in order to handle multiple attachments and send all of them in one email), i get an error saying “The operation ‘Initialize variable’ can only be used at top level.”

    How do i get around this if I can’t initialize the variable? I also tried adding the condition at the end after initializing the variable, but before sending A) an email with attachments or B) an email without attachments, but it still fails the Parse JSON step since there’s no attachment.

    Reply
    1. Sami Jumppanen says:
      December 22, 2022 at 11:52 am

      You really need to initialize all the variables on the top level. “Initialize” doesn’t mean you need to set the contents of the variable. It means the system has some named space reserved for your data. Just put the Initialize variable in the beginning of the flow, give the name and type.

      Later in the flow you use Set variable action to accomplish what you need.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


NEW! Master the HTTP requests to SharePoint with a new cheat sheet!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Use Power Automate to forward Outlook events upon registrationJanuary 29, 2023
  • Why the condition is false for the same numbers (Power Automate)January 25, 2023
  • How to forward event invitation to other calendar (Power Automate)January 22, 2023
  • Run ‘For selected item’ flow from non-default environment (Power Automate)January 18, 2023
  • Hide button in SharePoint list after Power Automate flow startedJanuary 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes