Groovy scripts

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

You can run Groovy scripts in conditions and validators and post functions. They give you more power and flexibility, but are recommended for advanced users.

Configuring Groovy scripts

Before you run any Groovy scripts, you have to configure how they’re used on your instance.

  1. Go to Administration  > Manage apps > Assets Allowlist.
  2. Decide who can use the Assets script console and select Jira administrators and Jira system administrators or Only Jira system administrators. The default setting is Only Jira system administrators.
    When deciding who can access the Assets script console, keep in mind that it’s used when adding conditions, validators and post functions.

    To change who can access the Assets script console, you must be logged in as a user with the Jira system administrators global permissions.

  3. Add the Groovy scripts that you want to run to your allowlist. Enter the filename of a script on your server and select Add script to allowlist. Repeat this action for all of the scripts you want to use.

  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


When adding a Groovy script, Assets workflow functions have the following variables pre-defined, so you can use them in your scripts.

issueThe issue to be transitioned.

The original issue.

You can use the attributes of issues as conditions. For example, if you want something to happen if the assignee has changed, use the following code in your condition:

issue.assignee != originalIssue.assignee

The current Jira user.

To check if the reporter is the current user, use the following code:

currentUser == issue.reporter

A log framework. You can log to atlassian-jira.log by:

log.warn("This is a warning!");


If you're looking for some inspiration and examples, see Groovy script examples.

Last modified on Apr 29, 2024

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.