Site dependent visible object
Looking for a nice method to control visibility within a form that the user is in the testing site. For example, a rich text object "You Are On The Test Site" would be visible only when in the test site.
-
Hi Dale
There are several approaches for that case - best two that comes into my mind:1. Check the Web/Site URL
Prerequisite: you have something in the site url you can differentiate prod from test site
Check if the current url contains specific text like this:=[[@Web.ServerRelativeUrl]].contains("test")
2. Configuration List Entry
Create a (hidden) config list in the site.
Create a list entry containing a Prod-Flag or a choice field System Type with values "Test" and "Prod" which you can set on each site different.
To check this flag/value on the form's Visible Expression use the GetFirstValueForQuery function like this:=[[@Web.GetFirstValueForQuery('YourConfigList', '<Where>filter to get back the correct config list entry</Where>', 'YourSystemTypeFieldName')]]=="Prod"0 -
Thanks Christof, this is just what I needed.
0
Please sign in to leave a comment.
Comments
2 comments