Skip to main content
5 simple scripts to automate issues in Jira
Share on socials
A script editor inside Jira exudes magic and lightning
Andra Dinu
Andra Dinu
Jess Thompson
Jess Thompson
4th January, 2023
Jira
Data center icon
Cloud icon
Server icon

5 simple scripts to automate issues in Jira

Get five simple starter scripts for working with Jira issue automation to help you save time and effort when automating issues in Jira.
In this blog, we'll show you how our ‘Getting Started with Jira issues’ collection of script snippets will help you save time and effort when automating issues in Jira. Since there are too many useful scripts in this collection to cover in a single post, we've hand-picked just five to talk about here.

View this script collection

This collection of snippets is a great place to start if you’re new to ScriptRunner for Jira Server and Data Center, or looking for some more basic functionalities. It contains nine scripts to help you extract information from Jira. Once you’ve got the hang of ScriptRunner, you can build on these scripts to create complex workflows and automate your administration.

Automate the creation of an Issue in Jira

This script saves you the time and effort of creating issues manually. You can add this script to anywhere in Jira that allows you to add a custom script e.g. listeners, workflow functions, REST Endpoints. You can either add this script as a standalone script, or as part of a larger script to create some serious automations!
Example
I am a Product Manager and I need to create a number of issues weekly for different departments. For example, I need marketing to provide me with their weekly analytics report for the product campaigns we have running. Previously, I was having to spend time every week manually assigning these issues. However, this script means that the issues are scheduled automatically to be created weekly.

Automate your Project creation in Jira

One of the most used day-to-day functions in Jira is creating a project, which is a collection of issues in various stages. This script works similarly to the ‘Create an issue in Jira’ script, it allows you to automate the creation of projects, for example in a workflow post function, a REST Endpoint or listener.

Clone issues or parts of issues

When cloning an issue, you will be able to clone attachments, subtasks and custom fields with this script. To make it easier to track which issues have been cloned, the newly created issue is linked to the source issue with a 'Clones' issue link. 
You might want to clone an issue if it contains in-depth details and you need a copy of it, or you want to split the workload for an issue. It may be necessary for you to clone an issue when an incident has been fixed and you need to file a Root Cause Analysis (RCA) ticket in another project.
Screenshot of a Jira issue
Screenshot of a cloned issue on Jira
When cloning the JRA-1 issue, you will see “is cloned by” issue link to the newly created JRA-5 issue.

Limit your behaviours to specific screens in Jira

A behaviour defines how fields behave for issues in a given project or issue context. Screens allow you to change the displayed fields when creating an issue, editing an issue or transitioning a workflow. This script allows you to execute a specific behaviour logic inside a specific issue screen, such as a workflow transition.
Example
I work in Product Support and customers often report bugs. When transitioning these issues from one state to another, such as ‘open’ to ‘in progress’ there needs to be a mandatory ‘affects version’ field. I can use this behaviour script to define that this field will be mandatory in these specific transitions.

Easily copy your issues to a separate project

This snippet shows you how to copy an issue from one project to another. This allows you to either copy the entire issue or the parts of the issue you need.
Example
My team and I have multiple projects in Jira, there’s a main project and several client projects which each have their own product owners and dashboards. Issues are created in the main project, however, one of my colleagues found the same issue in their client project. So, they use this snippet to copy this issue over to their project.

View this script collection

There are many more scripts in this collection for you to explore!