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 Apps / Re: Handling Exception...
Power Apps
Unanswered

Re: Handling Exception after when an action fails in Flow

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

How do you handle an exception of a request response action failure in flow into powerapps? 

@Mr-Dang-MSFT

 

 

Powerapps.PNGException.PNG

Categories:
  • Mr-Dang-MSFT Profile Picture
    Microsoft Employee on at

    Hi @Anonymous, it looks like Table1 does not exist. The previous step did not output any data which is why Response had an error. You'll need to receive data for this to work. And even if you do not receive data, you still need to have the same JSON structure in your data.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Mr-Dang-MSFTThanks for the reply, I'm sorry for not being too descriptive. Yes I am aware that table1 doesn't exist. Question is how do you catch the error from flow into powerapps by not outputting the json error string into  powerapps. more in terms of explicitly displaying a user friendly response back stating for example "you have no records".

  • Mr-Dang-MSFT Profile Picture
    Microsoft Employee on at

    @KroonOfficeSol may have an answer here as well.

     

    1. I check if the results are not empty. I explicitly did this in a compose action, but you can forego it and directly do it in a condition.
    2. I create a condition: if the results are not empty, send the regular response.
    3. Otherwise, do another set of actions. In the example below, I simply used the same response schema, but with a blank body. Feel free to do any other actions of your choice.
      Screenshot (314).png
    4. In PowerApps, the blank response will result in a default error that says something to the effect that there was no response. 

    5. If you want to customize the error to say something different, you can use Notify(). Below I'm using similar logic to the flow, "If the collection is empty, communicate a warning to the user that no records were returned."{40CDC7D4-CA77-49C6-9405-725903A5D653}.png.jpg

       

     

  • KroonOfficeSol Profile Picture
    587 on at

    @Anonymous

     

    The answer is fairly simple, you just have to insure there is a record returned from your stored procedure. You can do this by adding an UNION ALL SELECT statement to your Select query, returning a row with only NULLS.  Null should be matching the columns in the select statement.

     

    Basically Flow gets at least one record and so has the schema and the result to return, so the error won't occur.

     

    Then in PowerApps you remove the last row with this formula.

    ClearCollect(YourCollection, YourFlow.Run())
    ;Remove(YourCollection, Last(YourCollection))

    Leaving an empty well structured collection, when you don't have records returned.

     

     

    Made a video on this topic, see Learn PowerApps | 22 | PowerApps - Flow - SQL Server - import Dynamic Data

     

     

    Btw:  You just have to use three components: PowerApps, SQL, Request.

    A nice trick for when the ResultSet.Table1 is not in your dynamic options for the request is to:

    • go to the custom editor
    • put in a letter
    • go back to the dynamic results
    • Pick the ResultSet
    • go back and delete the letter
    • add ?['Table1']


    Hope this helps,

    Paul

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Mr-Dang-MSFT Thanks, The solution you've proposed works on my local machine but as soon as I publish the app the problem still persists on the published site

  • KroonOfficeSol Profile Picture
    587 on at
    This is because the clearcollect() gives an error.
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Mr-Dang-MSFT Thanks, The solution you've proposed works on my local machine but as soon as I publish the app the problem still persists on the published site

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @KroonOfficeSol Paul, thanks alot for the solution I have implemented what you've said regarding putting ResultSet.Table1 on the second request together. It works on the published site as well now. @Mr-Dang-MSFT

    Capture3.PNG
  • KroonOfficeSol Profile Picture
    587 on at

    @Anonymous

     

    Again, lose the condition, this is unnecessary. Only three steps are required, see pic.

     

    2019-02-07 16_38_25-Edit your flow _ Microsoft Flow.png

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @KroonOfficeSol I have to include 2 requests because I'm validating for when a when action fails between the first request.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard