How to Automate Jira using Apps and Scripts

by | Oct 23, 2019

Note: This is not intended as a comparison of automation solutions, but rather an overview of the automation tools we use with our clients.

Scripting.

It’s a word that evokes a wide range of emotions. For engineers and developers, it’s a normal everyday term that can sometimes be exciting. For non-techies, when the word presents itself, they get flustered. For Jira admins who aren’t developers, it means contacting someone who knows the domain, admitting your limitations, and waiting for help.

We still hear about scripting in the Atlassian world, but not as often as we used to. Why is that, you ask? Well because of features, enhancements, and apps that made it possible for non-developers users to achieve their goals without writing their own scripts. Thus, making it possible to customize Jira easily.

 

What Makes an Automation Script?

In order for an automation rule to execute we need two parts: a cause and an effect. Think of the cause like a “when” statement – When something happens…

Now think of all the possibilities available in Jira. Here are a few examples:

  • When an issue is transitioned
  • When a field is edited
  • When an issue is created
  • When someone comments on an issue
  • When an issue is assigned

Next, we need an effect. Think about what you want to happen when your “when” statement happens. For example, what do you want to happen when an issue is created or assigned? Jira can perform a number of effects, depending on the tool you decide to use to execute the automation rule. Here is a sample of effects (out of many more possibilities):

  • Do you want a linked issue to be created?
  • Would you like a comment automatically added?
  • Would you like to move the issue to a new status? 

The other variable we can add is a constraint. In the English language, this would be considered ‘a hypothetical’. In Jira, we can make the “if” statement dependent on JQL (Jira Query Language) or a number of other factors, such as checking if a field is a certain value.

To summarize, an automation script should include a cause, an effect, and possibly a constraint. Here is a good formula to follow: When is the cause, if is the constraint, and then is the effect.

Automation Options with Jira

Currently, there are a few options when it comes to writing automation within Jira. The most popular options are ScriptRunner for Jira, AutoBlocks for Jira, Automation for Jira, and Jira Service Desk’s out-of-the-box automation. All options involve choosing causes, applying constraints, then providing effects based on those causes and constraints. The difference is in the varying degree of difficulty and cost.

Adaptavist Options: ScriptRunner and AutoBlocks

ScriptRunner is one of the most popular apps in the Atlassian marketplace and will provide you with the most flexibility of all the automation tools in this blog. It’s been around the longest and has a count of over 22,000 installations. It’s worthy to mention – In order to use ScriptRunner, prior knowledge of the Groovy programming language is required. Below is an example of the script console used for writing groovy scripts and automating an instance.

 

ScriptRunner is fantastic for writing automation scripts. However, there are a couple of caveats: permissions and programming language limitations. For starters, in order to create a ScriptRunner automation script, you must be a Jira Administrator. In regards to programming language limitations, (as already mentioned) knowledge of Groovy programming is required. 

To help ScriptRunner users, Adaptavist has built-in scripts that you can use without knowing any Groovy. They built these for the most common use-cases that they saw their tool used for. In addition to the built-in scripts, Adaptavist also have built-in listeners and scripted fields which help users extend the functionality of Jira without needing to code.

Finally, they have introduced the Adaptivist Library. This is a resource where users can upload useful scripts to share with fellow ScriptRunner users. To get started, all you need to do is create an account.

Adaptavist is also working to make ScriptRunner capabilities readily available for users who don’t write code. They created a new app called AutoBlocks for Jira. This app gives the user a more visual representation of their automation functionality. 

Keep in mind: In order to use AutoBlocks, the System Administrator is required to install the app and grant you permissions. By default, only the System Administrator has permissions to create, view, edit, and delete workspaces (where rules are created) as well as add users and grant their permissions. Admins will still have the ability to approve workspaces. It’s important to know that prior programming knowledge is not necessary to use AutoBlocks.

Automation for Jira

Automation for Jira is a Jira app that provides similar functionality as ScriptRunner and AutoBlocks but with a much simpler interface than ScriptRunner and slightly simpler than AutoBlocks. A user can create causes (triggers), constraints (conditions), and effects (actions) without knowing any programming language. Below you can see an example of a rule started using Automation for Jira.

As you can see from the image above, this is much simpler than using ScriptRunner. (This could explain why the app is growing in popularity).

In order to use Automation for Jira, the System Administrator is required to install the app. Once installed, all Jira and Project Administrators will be able to create rules. Here’s a tip: Project Administrators are only able to create rules within projects where they are administrators. Therefore, it’s possible for a Jira Administrator to delegate their automation work at the project level to a trusted Project Administrator.

Note: Shortly before publishing this blog, Atlassian purchased Code Barrel, makers of Automation for Jira. We look forward to seeing what this acquisition will bring in the near future!

Jira’s Out-of-the-Box Automation

Jira Service Desk’s out-of-the-box Automation is the most simple way to automate your service desk. It is very similar to the Automation for Jira app but has a smaller scope of functionality.

 

Jira Service Desk’s out-of-the-box automation is available to Project Administrators and requires no prior programming knowledge. While it has less functionality than Automation for Jira, it is included with all purchases of Jira Service Desk.  

In our previous discussion of the 7 Hacks for Highly Successful Automation, we discussed this tool extensively. Make sure to take a look at our blog to learn more.

The Automation Scripting Verdict

ScriptRunner, Automation for Jira, AutoBlocks, and Jira Service Desk’s Automation are all powerful tools that will help enhance and extend Jira’s functionality. Although possibilities are endless with all of these options, ScriptRunner provides the most flexibility. Although the Apache Groovy community is growing, we realize finding expert resources familiar with both Jira and the Groovy programming language can be limited. Contact Atlas Authority’s team of Groovy programming experts if you find yourself using ScriptRunner and need help with the configuration.  

Subscribe to receive our monthly
blog posts in your inbox

Latest Blogs
Share This