cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DineshPathak
Frequent Visitor

How to disable PowerApp controls while the flow is run?

Hi Everyone,

 

Is there any way by which the controls on PowerApp screen are disabled while the flow is run?

Or if there is any way to find whether flow fail or succeed in PowerApp?

1 ACCEPTED SOLUTION

Accepted Solutions
rikdekoning Advocate IV
Advocate IV

Re: How to disable PowerApp controls while the flow is run?

Is there any way by which the controls on PowerApp screen are disabled while the flow is run?

  • Initialize a variable 'flowRunning' on the start of your PowerApp and set its value to false
  • On your control which runs the flow, first set the 'flowRunning' variable to true, then run the Flow and after that, set the variable to false again

flow.png

  • Now set each control that you want to disable to disabled,  based on this variable: 
    If(
        flowRunning,
        Disabled,
        Edit
    )

flow.gif

Or if there is any way to find whether flow fail or succeed in PowerApp?

  • Initialize a variable 'result' in your Flow
  • Place the Flow actions of your process into a Scope
  • Add 2 parallel 'Set variable' actions below your scope
    1. One to set the value of 'result' to 'Success'
    2. One to set the value of 'result' to 'Failed'

flow2.png

  • Set the Run after condition of the 'Success' action to 'is succesful'
  • Set the Run after condition of the 'Failed' action to 'has failed and has timed out'

flow3.png

  • Add a Respond to PowerApps action to the end of your Flow > Add an output > Text > 'result' with the result variable

flow4.png

  • Set the Run after condition for the Respond to PowerApps action to 'is successful' and 'is skipped' for both Set variable actions.

flow5.png

  • Change the Run() function of the control of your Flow that runs your Flow to the following: 
    Set(
        powerappsResult,
        PowerAppsbutton.Run()
    );
    This will set the powerappsResult variable to a record that contains all outputs you've configured in your Respond to PowerApps action. You can get the result by using powerappsResult.result in a label for example:

flow2.gif

View solution in original post

6 REPLIES 6
Dual Super User
Dual Super User

Re: How to disable PowerApp controls while the flow is run?

@DineshPathak 

 

For restricting the user from making any changes when the flow is running, you can add a loading screen and set its visibilty to true only when the flow is running, this could be done by following below steps:
 
1) Create a rectangle and stretch this on your whole screen, please make sure this is at the highest layer. Set its color to light gray (So that it covers the color screen and restrict all the controls usability).
 
2) Now download a gif of loading spinner from internet and upload this a media on your app. Insert an image control and put this gif as the image.
 
3) Set the visible property of both the controls to SpinnerTest
 
4) Now set the value of SpinnerTest variable on the button which triggers flow as:
 
Set(SpinnerTest,true);'PowerApps - Flow'.Run();Set(SpinnerTest,false)
 
This will show a spinner when the screen is getting loaded.
 
For getting the Flow Execution status, currently there is no such feature in the app. You can return a success message as a response to powerapps using "Respond to PowerApps" action in flow, but this will only be received if the execution completed successfully.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
rikdekoning Advocate IV
Advocate IV

Re: How to disable PowerApp controls while the flow is run?

Is there any way by which the controls on PowerApp screen are disabled while the flow is run?

  • Initialize a variable 'flowRunning' on the start of your PowerApp and set its value to false
  • On your control which runs the flow, first set the 'flowRunning' variable to true, then run the Flow and after that, set the variable to false again

flow.png

  • Now set each control that you want to disable to disabled,  based on this variable: 
    If(
        flowRunning,
        Disabled,
        Edit
    )

flow.gif

Or if there is any way to find whether flow fail or succeed in PowerApp?

  • Initialize a variable 'result' in your Flow
  • Place the Flow actions of your process into a Scope
  • Add 2 parallel 'Set variable' actions below your scope
    1. One to set the value of 'result' to 'Success'
    2. One to set the value of 'result' to 'Failed'

flow2.png

  • Set the Run after condition of the 'Success' action to 'is succesful'
  • Set the Run after condition of the 'Failed' action to 'has failed and has timed out'

flow3.png

  • Add a Respond to PowerApps action to the end of your Flow > Add an output > Text > 'result' with the result variable

flow4.png

  • Set the Run after condition for the Respond to PowerApps action to 'is successful' and 'is skipped' for both Set variable actions.

flow5.png

  • Change the Run() function of the control of your Flow that runs your Flow to the following: 
    Set(
        powerappsResult,
        PowerAppsbutton.Run()
    );
    This will set the powerappsResult variable to a record that contains all outputs you've configured in your Respond to PowerApps action. You can get the result by using powerappsResult.result in a label for example:

flow2.gif

View solution in original post

lyly1701
New Member

Re: How to disable PowerApp controls while the flow is run?

@yashag2255  

 

Hello! I developed a PowerApps that acts similarly to what you described, so when a flow is running, an overlay appears with a spinner, and once the flow is complete, a "Done" button appears (replacing the spinner), which in turns changes the visibility of the overlay to false.

 

This worked when my flow I was running lasted less than 1 minute, but when I tried to run a flow that was longer than 2 minutes, after the 2 minute mark, the "Done" button appeared anyway, and I had a runtime error:

 

Testforpowerapps.Run failed: Request to backend service timed out.

 

Here is what I have for the OnSelect property of the button that starts the flow:

Set(LoadScreen, true); Set(SpinnerVisibility, true); Set(FlowResult, Testforpowerapps.Run()); Set(SpinnerVisibility, false); Set(FlowComplete, true)

 

Do you know why this is occurring? I need the "Done" button to become visible only when the flow has completed.

rikdekoning Advocate IV
Advocate IV

Re: How to disable PowerApp controls while the flow is run?

Unfortunately, currently there is a two minute time-out limit when running a flow from Power Apps. This means that every flow that is running longer than two minutes will get a time-out error. There is nothing you can do about that
lyly1701
New Member

Re: How to disable PowerApp controls while the flow is run?

So if a flow is any longer than 2 minutes, it's impossible to run through PowerApps? Seems exceptionally restrictive...

rikdekoning Advocate IV
Advocate IV

Re: How to disable PowerApp controls while the flow is run?

I know. Hopefully it will be changed soon

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,826)