Disabling Power Apps Button while Running a Flow in Power Automate

I´d like to disable a PowerApps Button that runs a Flow in Power Automate (just while the Flow is loading), I want to avoid duplicity (double clicks) when sending files through that specific button.

I know how to disable buttons, but I do so only after the flow ended, not during it.

Once the Flow finished, the button should be available again in Power Apps.

Is that possible?

Rookie user here,

Thanks!

Upvotes: 0

Views: 2012

Answers (1)

Sumit Singh
Sumit Singh

Reputation: 1109

You can do the following steps:

  • Set a variable in PowerApps UpdateContext({Enable_btn: true})

  • In your flow, add a step (after your current last step), Respond to PowerApps and return a variable. E.g. Response as true.

  • Set the OnSelect property of your button as:

    // This disables the button
    UpdateContext({Enable_btn: false});
    
    // Enable button when flow is finished 
    UpdateContext({Enable_btn: Run.Your_FlowName().Response = "true")};
    
  • Set your button's DisplayMode as

    If(Enable_btn,
       DisplayMode.Edit,
       DisplayMode.Disabled)
    

NOTE: The only drawback is if your flow ran more then 120 sec, then you have a timeout error as this the default MAX time limit to get response from as flow.

Upvotes: 0

Related Questions