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

Onvisible not firing after navigating away

Hi All,

 

There was a similar question that was posted regarding this but duplicating the Screen didn't help me.

 

I have a list that I've created an app for. On this app, I require a 'NEXT' icon to only be visible to admin users therefore, I've added the following in the 'onvisible' field 'If(IsBlank(varUserAdmin),true,false)'

 

This works fine on initial trigger, but when navigating back onto the Screen, it no longer shows. Should I be adding a reset function to the onSelect field?

 

Thank you,

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Onvisible not firing after navigating away

Hi @AlexBohemia,

 

Have you checked on the reply in below post?

https://powerusers.microsoft.com/t5/General-Discussion/OnVisible-Not-Firing/td-p/62932

 

"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."

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Super User
Super User

Re: Onvisible not firing after navigating away

Where is "varUserAdmin" being set and how is it being set (is it a global variable or context variable)?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
AlexBohemia
Level: Powered On

Re: Onvisible not firing after navigating away

Hi,

 

It's a global variable.

 

A variable called 'varCurrentUserEmail' runs OnStart of the first screen which takes the logged in users' email address. A variable called 'varUserAdmin' then takes this variable and cross references it with an external list added as a data source. This list has 'people and groups' fields and lists users with admin access.

 

Thanks,

Super User
Super User

Re: Onvisible not firing after navigating away

Have you tried adding a label to the form with the same formula you are using in Visible property. This will let you know if the formula is evaluating as expected or if the issue is with Visible property not firing correctly.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Community Support Team
Community Support Team

Re: Onvisible not firing after navigating away

Hi @AlexBohemia,

 

Have you checked on the reply in below post?

https://powerusers.microsoft.com/t5/General-Discussion/OnVisible-Not-Firing/td-p/62932

 

"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."

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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

Users Online
Currently online: 189 members 4,525 guests
Please welcome our newest community members: