cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BFlow
Helper I
Helper I

Making a condition a file-upload

We have several flows which take an MS Form submission, including file upload, and creates a SharePoint list item, including attaching the file(s). That all works perfectly.

 

The problem occurs when someone fills out the form but does not upload a file (which is a valid, a file is not required.). Everything works (the SharePoint item is still created) but PowerAutomate flags it as a fail because the file-handling steps have no file to process. Eventually people are going to get so used to seeing the false-fails that we will miss investigating a real one.

 

Seems that a simple Condition step to bypass the file-handling stuff is all we need....BUT I cant figure out how to say "if a file was (or was not) uploaded...." for the condition.

 

Any nudges in the right direction would be most appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
BFlow
Helper I
Helper I

Hello @rsaikrishna Thank you for the suggestion. The solution we've arrived at is even simpler: We put in a Compose step and called the File Upload from Forms. This step will never fail, whether there is a file uploaded or not. Then we use a Condition wrapper: if the previous step's output is null, we skip the file-handling stuff, otherwise we do it.

 

Best

View solution in original post

2 REPLIES 2
rsaikrishna
Dual Super User
Dual Super User

@BFlow 

 

In your Power Automate, you can handle this issue with following steps:

1. After Get response details action, place a compose action by selecting Upload file property from your MS Form.

2. After compose action, place Parse JSON action and place the sample output of above compose action and content as Outputs of above compose.

3. Whenever ParseJSON action thows error, it means there is no file uploaded with the form. If there is no error, it means a file is uploaded with the MS Form. 

 

In the above steps, you need to use "Configure run after"  option to handle the exceptions. If you handle the exceptions, then your flow will NOT show as failed.

 

Example:

rsaikrishna_0-1632410598766.png

rsaikrishna_1-1632410646011.png

 

Reference article: https://docs.microsoft.com/en-us/learn/modules/error-handling/2-configure-run-after

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

 

BFlow
Helper I
Helper I

Hello @rsaikrishna Thank you for the suggestion. The solution we've arrived at is even simpler: We put in a Compose step and called the File Upload from Forms. This step will never fail, whether there is a file uploaded or not. Then we use a Condition wrapper: if the previous step's output is null, we skip the file-handling stuff, otherwise we do it.

 

Best

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,708)