cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
annaradio
Level: Powered On

UpdateContext works without performing any action

I have several screens, on two of them are display form and edit form

So the thing is: on display form I have a button which navigates me to edit form, and on edit form there is a button with onselect: UpdateContext({ButtonText: ", " & User().FullName}) and text field default: Parent.Default & ButtonText

When I go to edit screen for the first time, text field only has the value from its parent, then i press the button and to that value adds text from updatecontext. But when i go back to display screen and go to edit screen again, value from updatecontext adds without me pressing a button.

 

For example

First try

Text field: test

Press button

Text field: test, + value from updatecontext

 

Second try:

NO pressing button

Text field: test, + value from updatecontext, + another value from updatecontext

 

Is there a way to fix this?

2 REPLIES 2
SkiDK
Level 8

Re: UpdateContext works without performing any action

By screens, you mean different screens in Powerapps right? 

 

If you switch screens UpdateContext will not work. It's a local variable that is not detectable in another screen. This means that in every screen you can have the same but personal variable that only works in it's own screen. When you now leave a screen en go back, the UpdateContext will be executed again on new screen since it did not reset. 

 

If you want to pass variables between screens you'll have to use the Set(variable, value) method. This creates a global variable. Or somehow reset the UpdateContext somewhere when leaving screen, so it doesn't automatically get executed (adding another line of text) when going back to this screen. It should only execute when you click on the button.

 

I hope this helps somehow

annaradio
Level: Powered On

Re: UpdateContext works without performing any action

Yes, I mean different screens in Powerapps.

 

Thanks for your response, but this is not exactly what I meant. I don't need to pass variables between screens. Let me try to explain. I have Screen1 and Screen2.

Screen1 displays information and from it you can navigate to Screen2, where you can edit information. On Screen2 I have TextField and Button. Button onselect property is set to UpdateContext({ButtonText: ", " & User().FullName}), and TextField Default property is Parent.Default & ButtonText

 

Here is what I do. I go from Screen1 to Screen2. On Screen2, press button and value of TextField is test(it was there before), FirstName LastName. Click Save.

Then I go back to Screen1. After this I go to Screen2 again. And on Screen2, TextField value is test, FirstName1 LastName1(test and FirstName1 LastName1 is from previous pressing the button , FirstName2 LastName2. But after going to Screen2 I haven't pressed a Button.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 118 members 4,012 guests
Please welcome our newest community members: