Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Scripted variables is javascript that is executed and assigned to a variable to use anywhere in your web action config, such as the post body, the url ie by its name in mustache syntax.
Usage: {{ variable-name }}

Creata a Javascript variable

  1. Click the Variabels tab

  2. Choose Javascript variables on the toggle

  3. Click Add button

  4. Click in the MyVar field and rename the variable

  5. Write the script in the script field. More info below regarding usage

Script usage

The script must return a value, this value is assigned to the variable name and used in the configuration by entering mustache syntax.

The script has the following context already provided as variables to use;

response

the response of the parent action in raw text

jsonResponse()

a function that turns the response into json object

context

raw context of the action, such as name, url, method, headers

jsonContext()

a function that turns the context into json object.
example getContext().url gives the url

path(anyObject, jsonpath)

a function that returns the value in the object specified by the path.
Used when there is a need to pick a part of a json object.

getIssue()

return the issue as json if exists else null