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 / UpdateContext not work...
Power Apps
Answered

UpdateContext not working consistently

(0) ShareShare
ReportReport
Posted on by 45
I have several buttons in my canvas app that trigger different containers using UpdateContext.  For example, I have a Reset button on my app that displays a "dialog" to the user.  The OnSelect action for the reset button simply runs the following:
 
UpdateContext({varShowResetWarning: true});
 
The reset dialog is really a container whose Visibility property is set to varShowResetWarning.
 
What's been happening lately is the buttons don't work unless I go into each container and change the Visibility property in some way. For example, if I backspace the g in the variable and put it back in, the button will start working.  
 
If I start a monitoring session, the button click is getting registered correctly as a UserAction and the result is Success.  Looking at the formula, it's showing exactly what I'd expect:
 
btnReset.OnSelect
UpdateContext({varShowResetWarning: true});
 
I'm stumped. Any ideas?
Categories:
I have the same question (0)
  • ronaldwalcott Profile Picture
    3,862 Moderator on at
    Do you see this behaviour every time you exit the screen then go back into it. How are you setting the values to false? Show a complete example of how you have it configured.
  • Verified answer
    mmbr1606 Profile Picture
    14,615 Super User 2026 Season 1 on at
    hey
     
     
    question:
    do you remain on the same screen or navigate away and then come back to it? updatecontext is bound to a screen and is no global variable. did u try the same with Set() instead?
     
     
    if my answer helped please mark as verified,
     
     
    cheers
  • ingrtodd Profile Picture
    45 on at
    @ronaldwalcott Thanks for the reply. This behavior happens intermittently, but I mostly notice it when I edit the app the next day.  If I change the visible property as described in my post, it works until the next day. Yet if I forget to fix it and just publish, it's broken until I fix and re-publish. I know it doesn't make any logical sense, that's why I'm perplexed. 
     
    In my app's OnStart, I set varShowResetWarning to false. On the reset dialog, there's another button to confirm you want to reset. I'm doing another UpdateContext there to set the variable to false to dismiss the reset dialog.
  • ingrtodd Profile Picture
    45 on at
    @mmbr1606 Thanks for your reply. This is a single screen app. I am not navigating away from the screen.
  • ronaldwalcott Profile Picture
    3,862 Moderator on at
    Since this is a one screen app. Are you restarting the app every time? Are you in development or production? OnStart will only run if you restart the app and run the published app or if you are still in development running OnStart manually. You should examine what condition and control can be used to reset your context variables if you are not exiting the app after use to reset the variables. Some of the variables are probably maintaining their previous values. How do you close the dialogs, don't you set the variables to false?
    Show some of the code for the problematic buttons.
  • ingrtodd Profile Picture
    45 on at
    Changing all UpdateContext commands to Set appears to have resolved the problem. 

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard