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?