web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / OnVisible variables no...
Power Apps
Answered

OnVisible variables not always working

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

I have a bit of a problem:

In my form on 8 of the screens, I have a different toggle on each screen, with Yes/No.

If its a Yes (true), it updates the Status dropdown to 'Requires further review'

If its a No (false), it updates the Status dropdown to 'No further review required'

 

I then have a hidden label on the screen, which is looking at the value of dropdown (DataCardValue162) on its text property:

DataCardValue162.Selected.Value = "Requires further review"

 Then on the OnVisible of that screen I have:

If(Lbl_ReviewYes1.Text = "true", Set(ReviewYes1, Lbl_ReviewYes1.Text));

 

Then on on Screen2 I have the same set up , but looking at DataCardValue163, and the Lbl_ReviewYes2, is being set to ReviewYes2 and so on

 

I noticed if one of the Reviews are set to Requires further review, the label which is hidden, displays true, so that part of the logic is working, but when navigating away to other screens, it appears the OnVisible variable doesn't always get set.

 

So I thought the user is clicking the next button too quickly, so I've put a timer on the screen to show the next button 6 secs later.... I thought this fixed the issue, but didn't.

 

The problem I have is, if any 1 of the 8 screens have set yes to Requires Review, the code I have navigates all users to a Final Review screen, but sometimes what is happening is even though a further review is required, it navigates to the final screen as though it doesn't require a review and this is a problem.

 

I don't believe my next button code is where the problem is, and I'm fairly certain it's to do with the OnVisible variable set at each screen not always triggering.

 

Any ideas how I can fix/troubleshoot this please?

Categories:
I have the same question (0)
  • Silvester. Akakpo Profile Picture
    783 on at

    Hello @Anonymous ,

     

    Here  is a suggestion for you:


    - Rather than setting up the OnVisible property of each screen, set it on App Onstart property

    Concurrent(
    Set(ReviewYes1,lbl_ReviewYes1.Text),
    Set(ReviewYes2,lbl_ReviewYes2.Text),
    Set(ReviewYes3,lbl_ReviewYes3.Text) // and so on for the rest...
    
    )

    This will actually reference any text in the label and amend it to the variable, and this will be done across all screens.

    Let me know if you need more clarifications
    --
    Accept this as a solution if it works...

  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Please notice one point:
    The screen's OnVisible property will only be triggered when you load the screen.

    So even if you change the selected value of DataCardValue162 later, this property will not the triggered. So value of ReviewYes1 will not refresh automatically based on the selected value of DataCardValue162 .

    I suggest you set like this:

    1)set the toggle's OnCheck:

    Set(ReviewYes1,true)

    set the toggle's OnUncheck

    Set(ReviewYes1,false)

    set the toggle's OnChange:

    Reset(DataCardValue162)

    2)DataCardValue162's Default:

    If(Toggle1.Value,"Requires further review","No further review required")

    3)label's Text:

    DataCardValue162.Selected.Value = "Requires further review"

    4)inset a Timer

    set the Timer's OnTimerEnd:

    If(Lbl_ReviewYes1.Text = true, Set(ReviewYes1, Lbl_ReviewYes1.Text));

    set the Timer's Duration:

    3000 //3s

    set the Timer's AutoStart:

    true

    //do not use screen's OnVisible to set a variable value based on label's Text.

    Loading label's Text needs time, which may lead to setting the variable with wrong data.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    hi @v-yutliu-msft 

     

    Thanks for your detailed response.

    Just to clarify does @Silvester  workaround not work, I haven't tested it but I was implementing this yesterday evening.

     

    @v-yutliu-msft  You are right it appears the OnVisible Screen variable does need time, if I navigate to the screen, then away and then back to the screen it will always set the variable, but otherwise its hit and miss.

     

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    So have you tried my solution?

    Does using timer make any difference?

     

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    hi @v-yutliu-msft 

     

    I haven't yet, I was hoping if you can clarify if the other solution, suggested by the other helper would work?

  • Silvester. Akakpo Profile Picture
    783 on at

    Hi @Anonymous ,

    If you are still using my approach, the next step you need to do is to set the toggle true or false parameters to the various labels you provisioned for that purpose. 

    if(toggle.value="yes",lbl1.text="Review Required",lbl1.text="Review not required")// Do the same for the rest of the screens with the differents labels

    I used this approach because, that it aligns with the logic you are trying to implement.

    A great to achieve your goal also is what @v-yutliu-msft is suggesting...

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Since I do not know every details of your app, so I could not directly justify whether our solutions work for you.

    I suggest you try the solution that @Silvester provided and the solution that I provided above by yourself.

    If there's still any problem, please point out.

     

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    HI @v-yutliu-msft @Silvester 

     

     

    Thank you both, I will try both the suggestions and see which works best.

    I will look to report back tomorrow, or Monday the latest, if I encounter further issues with either solution

     

    Thank you so much for helping me with this

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    HI @v-yutliu-msft 

     

    I had same issues using @Silvester probably me not setting it properly.

     

    @v-yutliu-msft 

    I've used your suggestions, and removed the variable OnVisible of the screen, the only 2 things I have changed is the toggle OnCheck:

     

    Set(ReviewYes1,true)

    and OnUnCheck

    Set(ReviewYes1,false)

     

    This seems to be setting the variable I need to reference in my other screens. I need to test everything else but I dont think I need to change anything else... i'll report back once properly tested

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Ok, I'm looking forward for your feedback.

    Now, let me explain my solution:
    1)when you load this screen, timer will automatically start.

    After 3s, ReviewYes1 will set based on the value in the label.

    2)DataCardValue162's selection will change based on the toggle.

    label's value will change based on DataCardValue162.

    So Label's value will change with the toggle.

    But it will not change ReviewYes1's value.

    3)toggle's OnCheck, OnUncheck is used to change ReviewYes1's value based on that toggle's value.

     

    To sum up:

    ReviewYes1's value is decided by toggle's Default value when you firstly load this screen.

    If you make any change on that toggle later, ReviewYes1's value will change too.

    This screen's action will only affect ReviewYes1's value, not other variables in other screens.

     

    If my understanding is not right, please describe more clearly about how the variables change with the toggles.

     

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard