Part Visibility Examples
This chapter explains how to configure visibility using JavaScript, and provides a wide range of practical examples.
Visibility rules allow you to dynamically show or hide parts based on conditions. All visibility logic is configured in the Advanced tab of a part.
Visibility rules follow these principles:
If the condition returns true, the part is visible
If the condition returns false, the part is hidden
Where to Configure Visibility
To configure visibility rules for a part:
Open the part you want to modify.
Go to the Advanced tab.
Find the setting Set visibility via and choose JavaScript. Visibility rules described in this manual require the JavaScript option.
In the Visibility text box, you will write your JavaScript condition.
To insert part references, use the selector located below the Visibility box:
First dropdown: (filter dropdown below) – allows you to filter the list.
Second dropdown: choose the part to reference.
Click Add.
This inserts a placeholder such as:
#REPLACE-PARTVALUE-<InternalName>||Value#
Important: The list of available parts can be long. Parts are grouped by tab
The result will look like this in the UI:
Set visibility via: JavaScript
Visibility: contains your expression
Below the field, you will find informational notes explaining how Plain text, NCalc, and JavaScript visibility behave.
Basic Visibility Examples
Value equals X
Example
Value is not equal to X
Example
Multiple Allowed Values (X, Y, Z)
Example
Yes/No Fields
Value is TRUE (Yes)
Value is FALSE (No)
Combining AND and OR
Source logic example:
JavaScript version:
Multiple AND Conditions
Source logic:
JavaScript:
Example with two Yes/No fields
Show the part when any value is selected in another part
Multiselect Visibility Rules
Important:
For multiselect fields, the recommended approach is:
Set visibility via: Plain text
Insert only the part reference:
This is usually enough.
Multiselect contains X
Multiselect contains X or Y
Example: show the field if the multiselect contains Conferences OR Miscellaneous personnel costs.
Numeric Comparisons
Value greater than X
Note: the internal label appears twice.
OR Between Two Yes/No Fields
Version 1:
Version 2 (short form):
Example
Show a field if any of two numeric fields is greater than 0
Example fields:
Participants_0_to_12
Participants_12_to_18
Note: JavaScript variable names cannot start with a number.
Clearing values of hidden fields
If a part becomes hidden, its value normally remains stored. To ensure hidden values are cleared, return an empty string via the Default value (JavaScript).
Yes/No field
Text field
Triggers work recursively, ensuring dependent fields are also cleared.
Visibility Based on Phase
Show part only when the service phase equals “PhaseX”
Show part from PhaseX onward (using phase order)
Summary
This chapter explains how to configure visibility with:
equality and inequality checks
multiple allowed values
Yes/No logic
AND/OR combinations
multiselect content checks
numeric comparisons
clearing values of hidden fields
visibility based on workflow phase or phase order
All examples are ready for copy/paste into the Visibility field of the part.
Last updated
Was this helpful?