cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

OnVisible Not Firing

I have a rather complex PowerApp that utilizes a multi screen form. I keep runnning into an issue where the OnVisible events will not fire correctly. They usually fire the first time correctly, but if I navigate away from the page and come back later - they will not fire a second time. I have to either restart the entire app or cut the code from the property, navigate away, and then navigate back and then paste the code back in to get the code to fire correctly on the next screen load.

 

It makes no sense as it works correctly sometimes and other times does not fire at all. This only started happening after I added in a process that collects some data on screen visible into a collection. However, this is not the only thing that is not working - everything including simple updatecontext variable statements are not working the second time around.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: OnVisible Not Firing

Thank you for answering but neither situation really applies to my situation. This is an actual bug and not a problem in my code. I ended up getting rid of it by simply duplicating the page and deleting the old one - no code changes required.

View solution in original post

8 REPLIES 8
Highlighted
Community Support Team
Community Support Team

Re: OnVisible Not Firing

Hi @Anonymous,

 

Thanks for the feedback.

Per testing, the OnVisible works when navigating between screen from my side.

Besides, would it be possible to put the formula under the Navigate button, instead of the OnVisible property of the screen?

We could pass the Variables within the Navigate () function:

Navigate( Screen, Transition [, UpdateContextRecord ] )

For example:

Navigate( Details, ScreenTransition.Fade, { ID: 12 , Shade: Color.Red } )

Function reference:

Back and Navigate functions in PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: OnVisible Not Firing

One thing to notice is that controls are notified of changes in variables that are used in their properties - if the UpdateContext (or Set) call in a screen sets a variable to the same value that it had been set before, then no controls will be notified of it.

 

For example, if in a screen you have on its OnVisible property this expression:

UpdateContext({v: true})

And you have a toggle whose Default property is set to 'v', when you first navigate to that screen, the value of 'v' will be changed from nothing (Blank()) to true, and the toggle will be notified of that change, updating its value to selected (On).

 

If, in that screen, you change that value by changing the toggle back to unselected (Off), navigate to a different page, then navigate back, the OnVisible handler will set the value of 'v' to true - but that was already the value that it had, so nothing changes and the controls don't get notified of any changes, so the toggle won't be turned on.

 

If this is your scenario, there are a couple of things you can do. You can force the value of the variable to change:

UpdateContext({v: false}); UpdateContext({v: true})

Or if the value is being used for a default value of a control, you can explicitly call the Reset function on the control, to force it back to its default value.

Anonymous
Not applicable

Re: OnVisible Not Firing

Thank you for answering but neither situation really applies to my situation. This is an actual bug and not a problem in my code. I ended up getting rid of it by simply duplicating the page and deleting the old one - no code changes required.

View solution in original post

snagadiya
Level: Power Up

Re: OnVisible Not Firing

Hello,

 

I am facing the same issue. On android app, second screen's onvisible event is simply using collect function but it is not working.

I tried duplicate screen and delete old screen but still I have same issue.

 

I am not able to understand is that issue with PowerApps android app or bug.

Any help or pointer is very much appreciated.

Thanks,

 

Anonymous
Not applicable

Re: OnVisible Not Firing

In my case, I had the impression that the OnVisible wasn't run because some variable wasn't set, sometime.  I think is a timing problem, but not sure.  Still relatively new to PowerApps.

I was doing something like this : 

UpdateContext({varOne:DataCard1.Value})

 

Somehow, in somecases, my variable was empty. This was a big problem.

 

I solved my problem by doing this instead : 

UpdateContext({varOne:Gallery.Selected.MyField.Value}).


Note : MyField and DataCard1 is the same field.
Happy PowerApps !

rneel
Level: Powered On

Re: OnVisible Not Firing

Duplicating screen fixed it for me too, thanks!


@Anonymous wrote:

Thank you for answering but neither situation really applies to my situation. This is an actual bug and not a problem in my code. I ended up getting rid of it by simply duplicating the page and deleting the old one - no code changes required.


 

mj2
Level: Powered On

Re: OnVisible Not Firing

Try using Classic Rendering from App Settings -> Advanced Settings -> (turn off) Improved app rendering.

After turning off this setting, all started to work for me.

 

This is certainly a bug and should be fixed before disabling Classic rendering!!!

bryan_0226-ag
Level: Powered On

Re: OnVisible Not Firing

I had the same issue. Duplicating the screen did not help. 

I solved it by adding an Icon that [OnSelect] refreshed the datasource and regenerated the variable containing the data:

 

OnSelect: Refresh(DataSource);Set(variable,Filter(DataSource, criteria, criteria...);

 

That solved the issue. Not perfect but it works.

 

 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,434)