Groovy scripts
You can run Groovy scripts both in conditions and validators and post functions. They give you more power and flexibility, but are recommended for advanced users.
Good to know
Each Groovy script has to be whitelisted. To add Groovy scripts to the Whitelist:
- Go to Administration > Manage apps > Insight Whitelist.
- Select Edit settings.
- Enter the filename and the full path to the script like in the example below:
4. Select Save.
Ensure that the directory and the subdirectories where your Groovy script is located are readable by all users and executable by the user running Jira. For example:
=$ ls -al ~/Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts
total 8
drwxr-x--- 3 jira staff 96 Nov 24 21:47 .
drwxr-xr-x 21 jira staff 672 Dec 1 15:48 ..
-rw-r--r-- 1 jira staff 2421 Nov 24 21:47 Move Object to Archive.groovy
Variables
When adding a Groovy script, the Insight workflow functions has the following variables pre-defined, so you can use them in your scripts.
Variable | Description |
---|---|
issue | The issue to be transitioned. |
originalIssue | The original issue. You can check conditions, like if the assignee has changed by:
|
currentUser | The current Jira user. You can check if the reporter is the current user by:
|
log | A log framework. You can log to
|
Examples
If you're looking for some inspiration and examples, see Groovy script examples.