Visibility conditions control whether a field, submit button, or section appears on a page in SmartSimple, based on the syntax and operators covered below.
It is recommended that global administrators enable the new syntax. From from System Options in Global Settings, toggle Enable New Variable Syntax Set on and toggle Disable Classic Variable Syntax Set on.
Validation Formula Syntax
Validation formulas, such as those checking an email format or an integer value, use the same tag syntax as visibility conditions to reference a field's value.
| Use Case | New Syntax | Old Syntax |
|---|---|---|
| Email validation | isEmail({{value}}) | isEmail(@value@) |
| Phone validation | isPhoneStr({{value}}, "XXX-XXX-XXXX") | isPhoneStr(@value@, "XXX-XXX-XXXX") |
| Integer check | parseInt({{value}})=={{value}} | parseInt(@value@)==@value@ |
| Length syntax | {{value}}.length > 1 | @value@.length > 1 |
| Numeric range | {{value}}>1 && {{value}}<5 | @value@>1 && @value@<5 |
| Patterns | isMatch({{value}},'LLN',false) | isMatch(@value@,'LLN',false) |
Commonly Used Visibility Conditions
Commonly used visibility conditions control whether a field, submit button, or section displays, based on the value of another field.
| Condition | New Syntax | Old Syntax |
|---|---|---|
| Field is visible only if Status is Draft or Open | "{{status}}" in ('Draft','Open') | "@status@" in ('Draft','Open') |
| Field is visible only when it contains a value | "{{fieldname.length}}"*1>0 | "@fieldname.length@"*1>0 |
| Field is visible if the type is not Contract | "{{Type}}"!="Contract" | "@Type@"!="Contract" |
| Field is visible only after February 6, 2015 | "{{date(currentdate)}}">"2015-02-06" | "@date(currentdate)@">"2015-02-06" |
| Field is visible only if Start Date is on or after May 1, 2009 | "{{fullstartdate}}" >= "2009-05-01" | "@fullstartdate@" >= "2009-05-01" |
Date Field Visibility Conditions
Visibility conditions based on date fields follow a specific field naming convention.
@fullstartdate@ instead of @startdate@, and @fullenddate@ instead of @enddate@. This formats the stored date as yyyy-mm-dd so it can be compared using the less-than (<) and greater-than (>) operators.This example shows a field only when the Start Date is on or after May 1, 2009:
New syntax:
"{{fullstartdate}}" >= "2009-05-01"Old syntax:
"@fullstartdate@" >= "2009-05-01"
This example shows a field only when today's date is after the Start Date:
New syntax:
now()>'{{fullstartdate}}'Old syntax:
now()>'@fullstartdate@'
Multiple Visibility Conditions
A visibility condition can evaluate more than one condition.
For an OR condition, use two pipe characters (||). The field appears when either condition is true. This example shows the field when the status is Closed or when the user is John Doe:
New syntax:
"{{status}}" = "Closed" || "{{me.fullname}}"="John Doe"Old syntax:
"@status@" = "Closed" || "@me.fullname@"="John Doe"
For an AND condition, use two ampersands (&&). The field appears only when both conditions are true. This example shows the field only when the status is Closed and the user is John Doe:
New syntax:
"{{status}}" = "Closed" && "{{me.fullname}}"="John Doe"Old syntax:
"@status@" = "Closed" && "@me.fullname@"="John Doe"
Use brackets to control the order in which conditions are evaluated. This example shows the field only when the status is Closed or Cancelled and the user is one of the three named individuals:
New syntax:
( "{{status}}" = "Closed" || "{{status}}" = "Cancelled") && ("{{me.fullname}}"="John Doe" || "{{me.fullname}}"="John Deer" || "{{me.fullname}}"="Dear John")Old syntax:
( "@status@" = "Closed" || "@status@" = "Cancelled") && ("@me.fullname@"="John Doe" || "@me.fullname@"="John Deer" || "@me.fullname@"="Dear John")To check the status of the parent Level 1 record, reference the status directly or use the In operator. Both of these are true when the Level 1 status is Draft:
New syntax:
'{{opportunity.status}}'='Draft'Old syntax:
'@opportunity.status@'='Draft'
New syntax:
'{{opportunity.status}}' In ('Draft')Old syntax:
'@opportunity.status@' In ('Draft')Use Not In to exclude statuses. This is true unless the Level 1 status is Draft or Open:
New syntax:
'{{opportunity.status}}' Not In ('Draft','Open')Old syntax:
'@opportunity.status@' Not In ('Draft','Open')A condition can also be set so that it is always true or never true. These do not use variable tags, so the syntax is the same in both versions:
| Result | Syntax |
|---|---|
| Never true | 1=0 or false |
| Always true | 1=1 or true |
Advanced Visibility Condition Examples
These examples use object syntax and combined conditions in a UTA/module.
Show a Level 2 field only if the user is assigned Role ID 12345 on the parent Level 1 record:
New syntax:
",{{parent.[#(?object=contact::criteria=roleid=12345)~userid~,#]}}" LIKE "%,{{me.userid}},%"Old syntax:
",@parent.[#(?object=contact::criteria=roleid=12345)~userid~,#]@" LIKE "%,@me.userid@,%"
Show a field on all types except Type A, unless Question 1 is answered Z:
New syntax:
("{{parent.type}} " = "A" && "{{cmb_Question1.combovalue}} " = "Z") || "{{parent.type}} " != "A"Old syntax:
("@parent.type@ " = "A" && "@cmb_Question1.combovalue@ " = "Z") || "@parent.type@ " != "A"Quoting Variables in Visibility Conditions
Enclose variables in double quotation marks rather than single quotation marks. A single quotation mark can act as an apostrophe, so a variable that is replaced with a value containing an apostrophe can end the statement early and cause a server-side error. A double quotation mark stored in a value can cause the same problem, but stored double quotation marks are less common.