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 / Updating Context Value...
Power Apps
Unanswered

Updating Context Value from SharePoint List Value in OnVisible

(0) ShareShare
ReportReport
Posted on by

I currently have a few datacards on my View and Edit forms that hide if a value on SharePoint is edited on the form. When the EscalateS2 field on SharePoint is changed to YES (Control is a Toggle on the form and the SharePoint List field is a YES/NO type.  I have been controlling this with the Context of "s2Visible"

 

The toggle is set to OnCheck run:                      UpdateContext({s2Visible: true})   

and OnUncheck it runs:                                      UpdateContext({s2Visible: false})

 

However I've not been able to figure out how to make it check the field when the form is loaded from scratch so it only retains from previous sessions causing UI issues. 

 

I had tried added the following to the Screen's "OnVisible" to try and update the Context instantly on load

If('SHAREPOINTLIST'.EscalateS2="Yes",UpdateContext({s2Visible: true}),UpdateContext({s2Visible: false}))

 

However this fails with a "Invalid Argument Type" error message, so I think I'm messing up the coding, any ideas? 

Categories:
I have the same question (0)
  • LRVinNC Profile Picture
    2,297 on at

    You need to check your toggle's setting using true/false, not "YES"/"NO".    The toggle is actually saved as a boolean.  

    If('SHAREPOINTLIST'.EscalateS2=true,UpdateContext({s2Visible: true}),UpdateContext({s2Visible: false}))

  • Community Power Platform Member Profile Picture
    on at

    Thank you for the advice, sadly though when amending it to that code I still get "Invalid Argument" errors when putting that in the OnVisible properties of the screen, should this go elsewhere or would there be a better way to check a field for a value and update the context when the form is loaded?

     

    Kind Regards

  • panand99 Profile Picture
    641 on at

    Hi @Anonymous 

    Use this -

     

    If('SHAREPOINTLIST'.EscalateS2<>true,UpdateContext({s2Visible: true}),UpdateContext({s2Visible: false}))

     

    hope this helps

     

    Thanks,

    Prashant

     

    please mark this accepted if it fulfill your requirement

  • Community Power Platform Member Profile Picture
    on at

    Sadly this is giving the same error code message as well.

     

    Is there an alternative way of having the form check a YES/NO value from the selected SharePoint item then updating the context accordingly when the form is loaded?

  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    Solved it, I replaced 'SharepointList.EscalateS2' with 'SharePointIntegration.Selected.EscalateS2' and now it works!

    So the final code was 

     

    If(SharePointIntegration.Selected.EscalateS2=true,UpdateContext({s2Visible: true}),UpdateContext({s2Visible: false}))

     

    Thank you all for your help!

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 310 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 228

Last 30 days Overall leaderboard