always refers to the latest version of Sitevision

Script - Variables

Variables make it possible to declare variables outside the code itself. These variables are then easier to adjust without having to go in and read (or understand) the script.


Variables can be added, edited, and deleted.

Add variables

When a variable is added, it must be given a variable name (which is also what you type in the code to use the variable.) You specify with a checkbox if it is mandatory to assign a value to the variable.

You can provide a description to facilitate future adjustments to the variable 

Finally, you select the variable type and can assign an initial value to the variable.  

Available variable types

  •  Boolean value
  • Single selection
  • Multiple selection
  • Style sheet
  • Colour
  • Integer
  • Metadata
  • Node in image archive
  • Node in file archive
  • Node in page tree
  • Page template
  • Text


To use a variable in the script, enter scriptVariables.VARIABLENAME (JavaScript) or $scriptVariables.VARIABLENAME (Velocity).

In the script, the variable can then be used in the same way as variables declared inside the script.

Variables and Elements

The variable function is especially useful when using the Script module in an Element. The script variables can then be exposed as configurable parts of the Element.

Once the Element has been exported and added as an add-on module, the script variables are configurable for whoever sets the module.

More information about Element Opens in new window.

The page published:

Did the information help you?