{{ Banner-UnderConstruction }}The Visibility Condition section of [[Custom Fields]], [[UTA Standard Field Settings|UTA Standard Fields]], [[Contact and Account Standard Fields]] and [[Submit Buttons]] allow you to use logical statements to determine whether or not a field is [[visible]] or not. Common visibility condition statements are based on roles, types, statuses, and even field values.
'''Note:''' Visibility Conditions take effect when the page is loaded. They will not run dynamically if the condition is based on changing the value in of a field that is on the page. If you wish to change the visibility of fields dynamically , you should use the [[Show/Hide Header]] procedure.<!--'''Examples'''-->
'''Examples'''===Basic Condition Syntax===<!--* To make the field visible after 06 February 2015.
* To make the field visible after 06 February 2015.
now()>"2015-02-06"
or
* To make a Contact field visible only to the contact and to System Administrators (''[[roleid]]'' 12345):
"@me.userid@"="@userid@" OR @me.inRole(System Administrator)@
* To make a field visible to a role (''[[inRole]]'' Reviewer):
@me.inRole(Reviewer)@
* To hide a field from those in the role ''Reviewer''
!@me.inRole(Reviewer)@-->
Visibility works by determining the truth of a given condition. For example: the field only shows for someone in the Reviewer role. In that case, the condition syntax would look like this:
@me.inRole(Reviewer)@
If the condition is true--that is, the user viewing the page does have the Reviewer role--then the field is displayed.
This can also work with a negative: the field is to be hidden from a Reviewer.
!@me.inRole(Reviewer)@
Note: because the statement must be true, the above syntax is actually looking to display the field to anyone NOT in the Reviewer role.
===More Examples===
{| class="wikitable"
|-
||'''Condition'''
||'''Syntax'''
|-
||Field is only visible if Status is either Draft or Open
* '''IMPORTANT:''' for a visibility condition based the '''startdate''' or '''enddate''':
:*:* Use ''''@fullstartdate@'''' rather than ''''@startdate@'''' :*:* Use ''''@fullenddate@'''' rather than ''''@enddate@''''.: * ''This will format the stored date as yyyy-mm-dd so it can be compared using < and >.''
"@fullstartdate@" >= "2009-05-01"
<!--** To make the field visible only if the date in the field named '''Date Initiated''' is on or after 2014-01-31
* To make the field visible only if the date in the field named '''Date Initiated''' is on or after 2014-01-31
"@Date initiated@" >= "2014-01-31"
** To hide the field for new Level 1 records until they have been saved once
This should not be done with a Visibility Condition. Use the [[New Record Display]] setting
** To make the field visible if the Template or Type is named '''Sample''' or '''Example'''
"@type@"="Sample" OR "@type@"="Example"
**To make the field hidden for a user if they have a [[UTA Role]] of ''XYZ''
INSTR("[#(?object=contact::criteria=rolename like 'XYZ')~userid~,#]","@me.userid@")=0
**To make the field visible for a user whose parent company has Organization category 1234
"@me.parent.catlist@" like "%,1234,%"
**To make the field visible only when the status is Draft or Open
"@status@" in ('Draft','Open')
* *::''Note: The above Visibility Condition would only be used for '''Standard Fields'''. [[Custom Fields]] have a separate [[Status Field Permissions|Status Field Permission]] section that can be used.''*
** To make the field visible only when it contains a value.
*To make the field visible only when it contains a value.
"@''fieldname''.length@"*1>0
* *::''Note: When used with [[Custom Field Type: Text – Multiple Lines|Multiple Line Text fields]] that may contain double quotes, use "<ssEscape>@''fieldname''.value@</ssEscape>"!="" (See [[Ssescape|SSEscape]] for additional information.)''*
**More Examples:
"@Destination City@"="Toronto"
"@Type@"!="Contract"
'''Note:''' remember to include the @fieldname@ in quotes.-->