The Adaptavist Group LogoDocumentation

Example Script Variables

An example of how to use a script variable is outlined below:

  1. Navigate to ScriptRunner > Script Variables.
  2. Click Create Script Variables from either the previously created list or the initial landing screen.
    The Create Script Variable screen appears:
  3. Enter a name in the Script Variable name field. For this example, we use EXAMPLE_VAR.
  4. Enter a password in the Script Variable value field. For this example, we use I am an example. You can click the eye icon next to this field to make it visible or not visible, as required.
  5. Click Save.
    Once saved, a confirmation message displays, and you are automatically redirected to the Script Variables page, as shown in the example below:
  6. Navigate to the Script Console.
  7. Click Script Context from the code editor, as shown below:
    The Script context modal appears with details of parameters/variables that are available for your scripts, including the script variable EXAMPLE_VAR created in the previous steps. For example:
  8. Close the Script context modal and enter println EXAMPLE_VAR in the code editor.
  9. Click Run. Once complete, you will see the Script Variable value previously created in Step 4 display in the Logs, as shown below.
    Tip: In this example, we referenced the saved script variable in the Script Console code editor. Saved script variables can also be referenced using the Script Context button in the editors for Script Listeners, Workflow Perform Actions, Scheduled Jobs, and Escalation Service.

Search documentation

Start typing to search the docs.