Many years ago there was a young Jira admin, who frustrated by repetitive manual tasks in Jira, decided to take matters into his own hands. Little did he know that the solution he created would not only solve his own challenge but would also make thousands of other Jira admins weep with joy. And so, thanks to the Atlassian community a ScriptRunner star (Jamie Echlin) was born.
Gotta script'em all!
Many times when chatting to ScriptRunner customers and users about its capabilities, I often get a familiar "I didn't know it could do that" look of surprise. For those of you who are nodding your heads reading this, I will share with you a few of my insights into the art of the possible with ScriptRunner. For those here to see what all the fuss is about, sit tight as you may just discover a useful tip or trick that will make a real difference to how you use Jira in the future.
ScriptRunner takes care of tasks that are repeatable, conditional, functional, time-consuming, complex, slow etc. etc... the list is endless but herein lie the reasons why it's so powerful.
Think of ScriptRunner as providing three core capabilities;
So why exactly is ScriptRunner making Jira admins so happy? A key reason is automation. Now before you grab your coat, no this is not a robot that will replace you. It is almost the opposite, it is a robot that does the hard work for you so you can focus on more interesting things.
Let's have a closer look at the features that enable this:
This is where the magic happens. The Script Console is where you can type in your groovy code to automate tasks in Jira. There is a documentation library that guides you through what is possible, you can copy and paste code and watch ScriptRunner listen to your command.
There are two ways to enter your script, you can either type it in the console or upload it, just make sure your code is saved in groovy format.
For those that are code-shy and want to to do ScriptRunner tasks with the click of a button (or two), then this is where you will find ready-made scripts that take care of certain tasks for you. For example, you can use the Copy Project script to create a new project from the configuration of another project. Simply fill in the needed information and hit Run, if you're feeling cautious you can press the Preview button to see the end result without executing it - now that's cool!
There are currently 17 Built-in Scripts that you can take advantage of today, this is one of ScriptRunner's most used feature and we are continuously adding to this list as per popular request.
This is one of my favourite features, think of Script Fields as a formula cell in Excel - but that's in it's most basic form. Script Fields gives you the power to modify fields in Jira Issues. For example; if you want to see if the due date for subtasks has been met, you can build a resume table to view each status.
Here's when things get really interesting. Script Listeners function like event handlers, so based on an event happening e.g an issue has been updated with a comment, you can create a script that can do further actions based on that event. For example, change the SLA (Service level agreement) of the issue and send an automated e-mail notification to your team. Script Listeners can be as basic as that or as complicated as you want, for example, you can make ScriptRunner update your Confluence page based on an event triggered in Jira, now that's really cool!
Let's take a look at how ScriptRunner lets you customise Jira to look and feel how you want; welcome Script Fragments. Have you ever wanted to edit your Jira page to include a twitter fragment that automatically includes a tweet based on a completed issue? You can go from changing the colour scheme of the Jira page to extending your Jira page to connect with external tools, for example, update GitHub once you complete a task on Jira, or connect to other IT Service tools such as Xmatters to notify you of any issues.
Script JQL Functions
When you have hundreds of issues in Jira and want a way to manage the list using specific filters, JQL Functions is your answer. Use it to customise how you manage your issues, whether that's calculating the difference between two dates, filtering issues by number of comments (sometimes the low priority issue can turn into high priority given the volume of interaction) or you can really delve deeper by scripting your own custom JQL (Jira Query Language) function.
REST Endpoints allow you to integrate ScriptRunner with just about anything that has a REST API. For example, if there is a plugin that you use to monitor your network and you want ScriptRunner to automate Jira notifications based on those, then you're about to be a very happy user. The is because you can make REST calls to send/receive data and communicate with external applications using this feature. The world is your oyster when it comes to what you can do.
Just when you thought you know everything there is about ScriptRunner, I have saved the best for last. Behaviours is one of the most customisable features in ScriptRunner. Behaviours allows you to modify a 'create issue' screen in Jira, create a ticket screen in Jira Service Desk, and customise the way your forms behave. Think of it as automated forms, for example, you can modify fields to be pre-populated with certain information, control whether it is visible or hidden, or apply dependency relationships between fields for when you want the form to dynamically change based on a user action.
The world really is your oyster with ScriptRunner
We've come to the end of our overview of ScriptRunner. When it comes to scripting in Jira I have hopefully convinced you that the world really is your oyster if you have ScriptRunner. Give it a try and let us know what you think, if you're a ScriptRunner user already we'd love to know how it helps you in your day-to-day job and how we can improve it to help you even more. If you're new to ScriptRunner check out our getting started video below: