setVariable
Sets a global variable. Global variables are stored in the memory and only persist until the application is fully closed, at which point they are removed.
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"params" (required) | Object | undefined | null |
Parameters
Key | Type | Description | Default Value |
---|---|---|---|
"async" | Boolean | Specifies whether the action should perform asynchronously. | null |
"value" (required) | String,Object | The value of the variable. | null |
"variable" (required) | String | The name of the variable. | null |
Inherited
From Base Action
Base Action
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"dynamicParams" | Object | Dynamic params to retrieve data from a specific context e.g. a userSetting. | null |
"leadingDelimiter" | String | The leading mustache delimiter to use. | null |
"params" | Object,Array | Object containing the properties of the action. | null |
"trailingDelimiter" | String | The trailing mustache delimiter to use. | null |
"type" | String | Type name of the action. | null |
Examples
Example 1: Create a global variable with assigned static value.
Goal: Create a global variable named "favoritePet" and assing it the value "cat".
Variable
and value
have to be assigned within the params
object of the action.
{
"type": "setVariable",
"params": {
"variable": "favoritePet",
"value": "cat"
}
}
Result:
The global variable "favoritePet" has been set with the value "cat".
Example 2: Create a global variable with assigned dynamic value.
Goal: Create a global variable named "favoriteColor" and assign it a dynamic value.
Variable
and value
have to be assigned within the params
object of the action.
{
"type": "setVariable",
"params": {
"variable": "favoriteColor",
"value": {
"context": "form",
"field": "pickedColor"
}
}
}
Result:
The global variable "favoriteColor" has been set with the dynamic value of the "pickedColor" form.