Scripted Variables in JavaScript allow you to execute and assign values to variables that can be used in your web action config. This can be used in the post body, URL, and anywhere in your config using Mustache syntax ({{ variable-name }}).
Creata a Javascript variable
Go to the Variables tab
Toggle to Javascript variables
Click the "Add" button
Rename the variable in the "MyVar" field
Write your script in the "Script" field
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. |
path(anyObject, jsonpath) | a function that returns the value in the object specified by the path. |
getIssue() | return the issue as json if exists else null |