Skip to main content
3 tips when writing custom ScriptRunner scripts
Share on socials
A script editor inside Jira exudes lightning and magic
An orange circle placeholder
Chirag Harendra
4 September 2016
Data center icon
Server icon

3 tips when writing custom ScriptRunner scripts

If you're writing your own scripts, you'll want to make sure you can test, debug and tweak them. These best practice tips can get you started.
ScriptRunner makes simple Jira automations easy and more complex enhancements possible. If you're already using ScriptRunner for Jira, you'll probably be thinking about how custom scripts can address your specific automation needs. Read on for 3 essential tips when writing custom ScriptRunner scripts.

Test, debug and tweak for custom ScriptRunner scripts

If you're writing your own scripts, you'll want to make sure you can test, debug and tweak them. That's where these best practice tips come in. One way to figure out what's going on with your scripts is to write logging messages in your Jira log files. It's easy to set these up with ScriptRunner.

#1: Include logging statements in your scripts

A great way to get started if you're new to writing ScriptRunner scripts is to include logging statements. They let you diagnose exactly what is happening with your code especially useful if it's not doing what you expect it to.

#2: Use an IDE to write your scripts

Writing a script by simply using the Javadoc can be painful. If your code is complex and logging statements are not enough you'll benefit from setting up an IDE. Click below to find out how to set up your application and Intellij IDEA 14 with Groovy.

#3: Include automated testing in your scripts

Automated testing gives you added peace of mind when developing scripts. You'll ensure that your script does what you want it to, including when there are corner cases that you might not have anticipated.
For more information, check out the ScriptRunner documentation or contact us via the Adaptavist support portal.

More scripting tips

View snippets, FAQs and training