web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Command button functio...
Power Apps
Unanswered

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 840 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 332 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 275

Last 30 days Overall leaderboard