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

Updating Context Value from SharePoint List Value in OnVisible

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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
    Microsoft Employee 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
    Microsoft Employee 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
    Microsoft Employee 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

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard