The Script Variables is the place where you can specify variables that can be injected into your scripts (Script Console, Script Listeners, Workflow Post Functions, Scheduled Jobs, Escalation Service). Those 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 like passwords that require encryption rather than hard-coding them in scripts directly.
|Please remember that variable value has a type String, even if the value is a number.|
Variable names must follow these rules:
start with a letter
only capital letters are allowed
only digits and underscore character (_) are allowed
Length limit for variable:
name is 32 characters
value is 128 characters
Now let’s define a script variable with name MY_FIRST_SHARED_VAR with value 'testValue' and run the below code:
logger.info("My variable has a value: " + MY_FIRST_SHARED_VAR)
You should see the log with content:
INFO - My variable has a value: testValue
Let’s define a variable with name NO_RETRIES with value '5' and run the below code:
NO_RETRIES + 10
The result will be 510 (string concatenation), rather than 15.