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 / 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,847 Super User 2025 Season 2 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,605 Super User 2025 Season 2 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,847 Super User 2025 Season 2 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

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard