Showing results for 
Search instead for 
Did you mean: 
Advocate II
Advocate II

Flow Blank SQL Query Response to PowerApps



I wrote a flow that works very nicely except when the SQL query returns nothing. The attachment named "Flow View Run Mode - Failed due to No Data" illustrates the original issue. PowerApps would receive a 502 Error stating it was a bad connection.


I added a condition to the Flow in order to differentiate if the SQL Query returned a table or not. If it did, send the query results back to PowerApps, otherwise respond to PowerApps with a 400 error. The "Flow Edit Mode Screenshot" attachment shows the flow condition.


This change worked, but I don't like it because it relies on the IfError function in PowerApps which is an experimental function that may go away. It also doesn't explicitly catch the 400 error.


I'd like to find a way to deal with this in Flow, but I can't figure it out. Can I return a blank query with the same schema as if there was data?


Frequent Visitor

One way you could possibly deal with it is by using 2 Run After actions, one that runs after the query succeeds and one if it fails, times out, or is skipped.

On the run after for Success return your value to powerapps.

On the run after for fails, etc then return a blank/null value or any other constant value.

In your power app just check if the value is null or not, or if you have it a constant value like 0 or “failed”.

Something like Set(ReturnValue, FlowName.Run(....);
If(IsBlank(ReturnValue), /*Handle failure and display error with Notify*/, /*Handle success*/)

You could also use UpdateContext instead of set if you only want a local variable.

Helpful resources

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users


We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (46,017)