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 / IfError is skipping st...
Power Apps
Answered

IfError is skipping step - help

(0) ShareShare
ReportReport
Posted on by 26

Hi Hope someone can help nd point out where I am making a mistake.

 

I have a flow in a canvas app wrapped in an IfError function and inide that a Set functionto store the error as a variable.

 

When the flow responds with an error, only the final step in the [IF] condition (highlighted in screenshot) is executed. The first step which I understand should be executed when an error is detected is skipped or doesn't stop the processing. Hope someone can help.

 

The code basically sets context variables to true to show status panels in the app. The Upload success panel gets shown despite an error being generated.

 

HarchR_1-1712672027275.png

 

Visible property of UploadError container: 

HarchR_0-1712672286222.png

 

 

Visible property of UploadSuccess container: 

HarchR_1-1712672321562.png

 

I tried using an [And] operator as I thought i might be using too many steps but that shows the error panel when there is no error generated.

HarchR_0-1712672751224.png

 

Categories:
  • JasonZF Profile Picture
    572 on at

    I never really liked IfError(), because I've had issues with it as well in the past. In this type of scenario, I prefer using a normal If() statement with the first value (your Set() function) surrounded by IsError(). Try this out and see if it works.

    If(
     IsError(
     Set(
     varFlowRunStatus,
     UploadAgreementDocument.Run(
     ...
     ).flowrunstatus,
     )
     ),
     UpdateContext(
     {
     locShowUploadSpinner: false,
     locShowUploadError: true
     }
     ),
     UpdateContext(
     {
     locShowUploadSpinner: false,
     locShowUploadSuccess: true
     }
     )
    )

     

  • HarchR Profile Picture
    26 on at

    Thanks for your help I appreciate it. Unfortunately that doesn't work. It still skips to the last rule for showing a success panel when an error is generated.

     

    I'll keep trying to find some way of working around it an post here if I find a solution. Right now though I thin I may have to leave error handling out of the app to get it done and instead let the flow catch block do the notification by email. Not ideal but it's an option.

  • JasonZF Profile Picture
    572 on at

    When you say your "flow responds with an error," what do you mean? Is this Power App somehow failing to communicate with the flow, or is the flow actually responding back, but with an error provided by a "Respond to PowerApp" action inside the flow? Is it possible that the Run() command in your Power App isn't actually failing?

  • Verified answer
    HarchR Profile Picture
    26 on at

    Right so after lots of frustration, I managed to work around this.

     

    IsError didn't work for my scenario as it produced the same result: The [Else if] condition was always executed no matter what.

     

    When the 'Upload' button is clicked, the flow is executed and responds with either "Success" or if it catches an error, it responds with the action and message text from the error JSON.

    HarchR_0-1713182008432.png 

    or 

    HarchR_1-1713182031916.png

     

     

    2. I stripped the IfError condition back to simple executing the flow and setting a variable called FlowRunStatus.

     

    3. I then run another If condition where If the returned value in the variable is "Success", then execute a context variable, else, execute another.

     

    3. The panels are then made visible depending which context variable is executed. I think the key here was moving the context variable execution out of the function that runs the flow and checks for a response.

     

    It's not the cleanest or most elegant way to run this as i would have liked but deadline for testing looms and it works.

     

    Final code below in case it helps anyone else with a similar issue:

    HarchR_3-1713182845092.png

     

    Thanks to those that tried to help. Appreciated as always! 

     

    @JasonWS I will start sing IsError instead of IfError from now on. Hopefully have more luck with it going forwards.

  • JasonZF Profile Picture
    572 on at

    That's what I thought. Even though what you were intending to be returned from the flow to be an "error," PowerApps doesn't see that as an error, since the command was executed successfully. That's why the third parameter was always being executed. 

    I do something similar in my flows. I have a status being returned ("sucess"/"fail" texts) along with any needed information. The "fail" side of the flow just has blank values for anything else that's normally provided from the flow. I then have logic based on whether the status is = "fail" or "success". Glad it works out now. With some of my newer flows, I even have as much as I can inside a Scope block, that way if any step within fails, it'll still trigger the "fail" side's Respond to a Power App action.

    JasonWS_0-1713184812539.png

     

  • HarchR Profile Picture
    26 on at

    Useful thanks!

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 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard