Difference between revisions of "Visibility Condition"

From SmartWiki
Jump to: navigation, search
(Multiple Conditions)
Line 42: Line 42:
 
* For an '''OR''' condition use two pipes (|)
 
* For an '''OR''' condition use two pipes (|)
  
  '@status@' = 'Closed' || '@me.fullname@'='John Doe'
+
  '@status@' = 'Closed' || '@me.fullname@'='Jane Doe'
 
''The above field will be visible either if the status of the record is ''Closed'', OR if the user viewing the record is named ''John Doe''.''
 
''The above field will be visible either if the status of the record is ''Closed'', OR if the user viewing the record is named ''John Doe''.''
  

Revision as of 16:55, 16 July 2009

The Visibility Condition section of Custom Fields and Standard Fields allows you to use logical statements to determine whether a field is visible or not.

Examples

  • To make the field visible after 06 February 2009.
now()>'2009-02-06' 


  • 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 2009-01-31
'@Date initiated@' >= '2009-01-31'


  • To make the field visible for a user with roleid 9999
',@me.rolelist@,' REGEXP ',9999,' =1


  • To make the field hidden for a user with roleid 9999
',@me.rolelist@,' REGEXP ',9999,' = 0


  • 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 Standard Fields. Custom Fields have a separate Status Field Permission section that can be used.


  • More Examples,
'@Destination City@'='Toronto' 
'@Type@'!='Contract'


Note: remember to include the @fieldname@ in single quotes.

Multiple Conditions

It is also possible to test multiple conditions:

  • For an OR condition use two pipes (|)
'@status@' = 'Closed' || '@me.fullname@'='Jane Doe'

The above field will be visible either if the status of the record is Closed, OR if the user viewing the record is named John Doe.


  • For an AND condition use two ampersands (&)
'@status@' = 'Closed' && '@me.fullname@='John Doe'

The above field will be visible only if the status of the record is Closed AND the user viewing the record is named John Doe.


  • You can also use a combination of these, using brackets to control the order of validation:
'@status@' = 'Closed' && ('@me.fullname@'='John Doe' || '@me.fullname@'='John Deer' || '@me.fullname@'='Dear John')

The above field will be visible only if the status of the record is Closed AND the user is one of the 3 named users.

See Also

Visibility of Custom Fields can also be controlled using:

For help constructing logical statements for Visibility Condition: