Script Variables

What are Script Variables?

You can use Script Variables to specify variables that can be inserted into your scripts (Script Console, Script Listeners, Workflow Post Functions, Scheduled Jobs, Escalation Service).

How to use Script Variables

The variables are encrypted and stored in your Jira Cloud instance. You can use them to share common variables between your scripts, or to store sensitive data such as passwords that require encryption rather than hard-coding them directly in scripts.

Please remember that a variable has a String value type, even if the value is a number. It is also worth noting that Script Variables are static and can only be set on the Script Variables page, so you cannot dynamically set the values of these via a script.

Naming Convention

Variable names must follow these rules:

  • start with a letter

  • only capital letters are allowed

  • only digits and underscore character (_) are allowed

Limitations

Length limits for variables include:

  • name is 32 characters

  • value is 128 characters

Before you Start


Have a look at some examples of Script Variables.


Create a Script Variable

  1. Navigate to ScriptRunner → Script Variables.
    Upon opening the Script Variables page you are presented with either a list of previously created script variables, or if you have not previously created any, you will see a landing screen.
    1. Click Create Script Variables from the previously created list. You can also choose to Edit or Delete your selected script variable via the Actions ellipsis on this page.

      OR
    2. Click Create Script Variables from the initial landing screen if none have been previously created.
  2. Enter a name in the Script Variable name field.
  3. Enter a password in the Script Variable value field.
  4. Click Save or Cancel. Once saved, you will see the Script Variables page displayed. You can click the eye icon next to the Password to make it visible, or not visible, as required.

Edit a Script Variable

  1. Navigate to ScriptRunner → Script Variables. A list of all script variables is shown.

  2. Click Edit on the Actions ellipsis of the script variable you wish to edit.

  3. Edit the fields as required. When all changes have been made, click Save. You can also click Revert to undo those changes.

  4. Click Save after all changes are complete. You can also click the Delete button and confirm when prompted.