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 / Command button functio...
Power Apps
Suggested Answer

Command button function not working on consecutive clicks

(0) ShareShare
ReportReport
Posted on by 195

Hi community

 

With command buttons now in GA as of a few days ago, I'm adding them into a model-driven app build.

 

The command OnSelect runs a fairly simple series of Power Fx commands (If, Notify, Confirm, Patch). The If and Notify functions first do some simple data validation, and the confirm displays a simple confirmation message. Then the patch updates a yes/no 'trigger' column to yes/true and this in turn triggers a flow using a Dataverse row modify trigger at the end of the flow it switches the trigger column back to no/false - ready for next time.

 

All is good when the command is run the first time - everything works perfectly. The Power Fx commands work, 'trigger' column goes to yes and the flow runs with the trigger switched back to no at the end.

 

However, if the command is clicked a second time the Power FX Confirm function works but the Patch isn't updating the 'trigger' column and therefore the flow doesn't run 🤔

 

Now, I've found out a couple of ways to get it to run. If I remove a value from any of the data validation columns (the ones that the If functions check, it displays the notifications. Replacing the values will then run the Power Fx and flow as normal. The other work around is refreshing the browser, this makes the commands and flow work every time. 

 

Now, instead of telling users they need to refresh the browser in between clicks...what can I do? Is there a function to add to the command to 'reset' it and allow it to run again?!

 

Thanks

Matt

I have the same question (0)
  • Suggested answer
    CU16011356-0 Profile Picture
    2 on at
    You can use Refresh(DataSource) function to reset state of Commandbar Button
     
    E.g. For button on Case form use Refresh(Cases).
     
    If(     
        Confirm("This will Perform blah action.",
            {Title: "Execute", ConfirmButton: "Yes", CancelButton: "No"}
        ),    
            Patch(Cases,Self.Selected.Item,{'MyFlag':true});Refresh(Cases),
        false
    )
     
    This should do the trick.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard