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 / OnVisible of screen no...
Power Apps
Unanswered

OnVisible of screen not working

(0) ShareShare
ReportReport
Posted on by 1,207

I have a formulae in the OnVisible property of the app's first screen. It sets context variables that I use to show/hide elements.

 

If(
 !varUserHasApps,
 UpdateContext({varEditMode: true, varListEdited: true}),
 UpdateContext({varEditMode: false, varListEdited: false})
)

 

In preview mode it works as expected and displays the items where varEditMode=false. If I play the app or view in browser it is executing the true condition instead of the false condition.

 

To test I added an extra screen and buttons to navigate back and forth. If I navigate to the 2nd screen and back again the formulae runs as expected.

 

varUserHasApps is set in the OnStart. It is set to either true or false depending on a collection containing data.

 

If(
 IsEmpty(colSavedApps),
 Set(varUserHasApps,false),
 Set(varUserHasApps,true)
);

 

Wondering if this is a bug or I'm missing something?

Categories:
I have the same question (0)
  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    Is this a standalone canvas app or an embedded canvas app?

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

    Hardit Bhatia
    thepoweraddict.com
  • Digital Profile Picture
    1,207 on at
    Hi @PoweAddict, It's a standalone canvas app. I intend to embed in a SharePoint modern site page in the future but for now it's standalone. Thanks
  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    Have you tried to put this code in the App OnStart as well? Not that you should have to do this but just curious to know how it behaves then.

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

    Hardit Bhatia
    https://thepoweraddict.com
  • Digital Profile Picture
    1,207 on at

    OnStart doesn't accept context variables. I'd have to replace the context variables throughout my app with global variables which I'd prefer to avoid.

  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    I completely understand. I just wanted you to try with one and let me know if it works.

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

    Hardit Bhatia
    https://thepoweraddict.com
  • Verified answer
    Digital Profile Picture
    1,207 on at

    I got this working by replacing the context variables in the screen's OnVisible property with global variables in the app's OnStart property.

     

    Still not sure why it worked in preview and not in play mode. 

  • JasonSmithTBS Profile Picture
    46 on at

    This "solution" is simply a work around. Was a proper solution/fix ever found?

  • SoggyGibblets Profile Picture
    11 on at

    I had a weird issue with context variables not working with an open ticket for over a year (magically started working at some point). I've just noticed today in an app that onstart is not calling onvisible for the initial screen. So it could either be that it isn't honoring the config setting (use non blocking onstart) or we again have context variable weirdness. I'm about to open a support ticket and I'll update this thread if they actually fix something (low liklihood). 

  • JasonSmithTBS Profile Picture
    46 on at

    I've been dealing with another weird and probably related issue where an app launches and the StartScreen value isn't be honoured and the app launches to the first listed screen, which in my case is a debug/developer helper screen. A refresh then loads the proper start screen oddly enough.

     

    To make matters worse, another screen I have in my app holds come common custom controls that are referenced throughout other screens (the controls are helpers for localization and some calculations - think functions). That screen, given its objects are referenced by the start screen prior to about a month ago always pre-loaded in the background and the "functions" used on the start screen worked fine. Today, I have to navigate to another screen and back for those "functions" to run properly. I don't know if this is related to recent changes to improve overall application launch times and the use of non-blocking OnStart.

  • SoggyGibblets Profile Picture
    11 on at

    Interesting. The year long issue we had seemed to indicate that the variable wasn't initially created maybe due to some form of optimisation. Referencing controls from other screens is now frowned upon and with settings for "keep visited screens in memory" looks like they'll break it if they haven't already.

     

    How old is your app? We have a few that are more than 4 years and looking at a total re-write.

     

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard