Skip to main content

variable

Last updated 3/02/2026

Definition

Five can hold global data for your application on a

variable
property on the
Five
object. The
variable
property allows values set as name value pairs through the use of the
setVariable()
function using Five’s API. The values can be accessed through code, or as properties on the
variable
property itself.

For example, accessing the value through the use of code can be done using the

function on the

Five
object -
five.getVariable(<variableName>)
, or you can use the
variable
property
five.variable.<variableName>
, which is useful as parameters to a query, or as mail merge template values, or in an If conditional field.

Global Variable Accessibility

Any part of your application can access variables stored using

. These variables are maintained in a shared application-wide context and are accessible to all execution environments within Five, including frontend code, backend functions, and server-side workflows.

Once a variable is set, it can be retrieved or updated at any time using

, regardless of where the variable was originally defined. This enables consistent state sharing across different parts of the application and removes the need to explicitly pass values between frontend and backend layers.

Variables remain available for the lifetime of the active session and provide a single, centralized mechanism for managing shared state.

Key Characteristics

  • Variables are globally accessible across the frontend and backend
  • A single variable is used for the entire application
  • Values persist for the lifetime of the active session
  • Access is consistent and synchronous via
    getVariable()

Screen Fields

When a query parameter is set to use

five.variable
, the Linked Parameter field on the Data Views form lets you use a screen field as its source. Once linked, Five automatically keeps the parameter value in sync with the screen field, ensuring queries always use the current screen context.

When you open the Linked Parameter dropdown, only parameters marked as a variable are available.

Examples

variable