I need to verify if a Microsoft Form was submitted with an attachment.
Here is the attachment option on my Microsoft Form
Here is how I have my Flow setup
Regardless of whether I have an attachment or not, I'm still getting "expression result = false". I'd expect to get a TRUE or FALSE depending on whether I had an attachment on the Form or not.
Here is an example of how to write a condition to check if a Microsoft Form response contains an attachment.
Step 1: Add the trigger "When a new response is submitted" and select your form.
Step 2: Get response details. In the Response Id, select "Response Id."
Step 3: Create a new Control and select Condition.
Step 4: In the box on the left, select Dynamic Content, then choose your question where users submit a file. In this example, the question is "Attach File (If applicable)."
Step 5: Select "contains" in the middle box.
Step 6: In the box on the right-hand side, type a single opening bracket (Don't include quotation marks)
Step 7: Add whatever actions you want in the "If yes" and "If no" fields.
Here is why this works:
If your question asks the user to upload a file, and the user doesn't upload a file, the raw output looks like this:
If your question asks the user to upload a file, and the user does upload a file, the raw output looks like this:
In this example, the "[" character appears only when the user submits an attachment. Therefore, if there's no "[" character, there's no attachment. If there is a "[" character, there's an attachment.
Final Notes
It's important to note that I don't have Microsoft Documentation to back up this theory. It's just something I've discovered, tested, and used on my end. It works reliably for me, but whether or not this example follows best practice, I can't say.
Thanks, this has helped me as well, since the attachment question in my form is optional
Thank you, @Nicolas07 . I had the same error and this worked for me.
So I solved my own problem 🙂
I changed my condition to simply check if the Forms question where documents can be uploaded is not equal to null. To do so I have simply left the field empty. See below.
Hi @abm ,
I am trying to do the same thing, but I am getting the following error on the condition:
Unable to process template language expressions for action 'Condition' at line '1' and column '27420': 'The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#length for usage details.'.
This is how my flow looks like.
It copies responses submitted in a Form into a Sharepoint list. I want it to copy also the attachments (i'm using a parse JSON) in the Sharepoint list too. But if there are no attachments, the Parse JSON fails. So I would like to have the condition to check first if there are any attachments. If yes --> Parse JSON. If not, go to the next step (send email from shared mailbox).
Thanks for your help!!
Thank you for the time you spend to help people with these questions. Your response helped me as well.
This helped me fixed my problem also.
Thanks a lot
@abm This is exactly what I was missing. Thank you so much and Happy New Year :)!
Hi @Anonymous ,
Please take a try with @abm 's solution and let me know if you have any problem s.
Best regards,
Alice
Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Yes you can add the output in the condition greater than 0 (Zero).
Or without the compose you can add the expression under the IF statement. See below.
Both should work.
Thanks
Michael E. Gernaey
497
Super User 2025 Season 2
David_MA
436
Super User 2025 Season 2
Riyaz_riz11
244
Super User 2025 Season 2