Mastering JIRA - Sample Chapter
Mastering JIRA - Sample Chapter
Mastering JIRA - Sample Chapter
ee
P r o f e s s i o n a l
E x p e r t i s e
D i s t i l l e d
P U B L I S H I N G
pl
e
Ravi Sagar
Mastering JIRA
Mastering JIRA
Sa
Mastering JIRA
Gain expertise in tracking project issues and managing them
efficiently using JIRA
Ravi Sagar
P U B L I S H I N G
Preface
JIRA is an issue-tracking tool from Atlassian, which has gained immense popularity
in recent years due to its ease of use, its customization abilities, and finely grained
control over various functions. Out of the box, JIRA offers issue and bug tracking
capabilities to create tasks, assign it to users, and generate useful reports. However,
the real power of JIRA lies in the customization that it offers.
Experienced JIRA administrators looking to learn advanced topics and expand their
knowledge will benefit from this book.
Packed with real-world examples and use cases, you will first learn how to plan
the JIRA installation. Then, you will be given a brief refresher of the fundamental
concepts. You will also understand the customizations in detail, along with a sample
data for various use cases. Several aspects of JIRA administration, such as user
management, groups, roles, and security levels, will be covered keeping in mind
the applications for enterprises. Next, this book will take you through the add-on
development to extend JIRA functionalities. It will also give you insights on how
to build applications on top of JIRA using the REST API. Various aspects of the
migration process from other tools using the CSV file will also be discussed.
The implementation of Scrum and Kanban techniques, along with Agile reports,
will be discussed. We will take a look at the Groovy script, which is a great tool
that empowers JIRA administrators with tremendous flexibility. We will also take a
look at some of the common database tables to fetch useful results and discuss the
possibilities to add custom CSS and JavaScript in our JIRA instance. Finally, we will
conclude the book by going through the best practices and troubleshooting steps to
help you find out what went wrong and how to fix it.
Preface
Preface
Chapter 11, JIRA Administration with Groovy Script Runner, introduces the add-on
that administrators can install and various additional features using scripting that
it brings, which helps JIRA administrators with various customizations that were
otherwise not possible.
Chapter 12, Accessing the Database, explains fetching the data directly from JIRA's
database. This chapter has various useful queries to retrieve information from the
database. The way to access data from embedded HSSQL database has also been
explained.
Chapter 13, Customizing Look and Feel and Behavior, talks about how to perform
extreme changes in the JIRA design using custom style sheets. This chapter also
discusses the possibility to control the HTML fields using JavaScript.
Chapter 14, JIRA Best Practices, discusses various points that JIRA administrators
should keep in mind not only before implementing JIRA, but also various practices
that they should employ on an ongoing basis.
Chapter 15, Troubleshooting JIRA, is the last chapter where various ways to identify
the problems in the instance is discussed. Common problems that people face in
JIRA are listed in this chapter.
Appendix, Integrating JIRA with Other Tools, has details on how various tools, such as
Git, Bitbucket, and Confluence can be integrated with JIRA.
[ 207 ]
2. In the search box, enter Script Runner and click on the Enter key. The Script
Runner add-on will appear in the search result list:
3. Click on the Install button and the Script Runner add-on will begin
downloading:
[ 208 ]
Chapter 11
[ 209 ]
2. In this section, the list of all the Built-in Scripts can be found:
3. Click on any of these links to run that particular built-in script. This will
further ask you to enter parameters relevant for that script.
Let's take a look at some of these Built-in Scripts.
Copying a project
Only JIRA Administrators have the permission to create a project in JIRA and change
the configurations too. Whenever there is a need to have an additional project in
JIRA, the administrator needs to manually create projects and then change their
schemes. Although, it's not a difficult task and usually takes 10 minutes of time,
sometimes there is a need to create ten projects and creating them manually could
take hours.
There is a built-in script in Script Runner to copy the project along with its
configurations, with or without its issues. Perform these steps:
[ 210 ]
Chapter 11
2. On the next screen, select Helpdesk as Source project, enter Target project
key and Target project name.
3. Tick the Copy versions and Copy components checkbox if you want to copy
the project versions and project components as well.
4. Click on the Run button to initiate the Copy project script.
Once done, the message is displayed at the bottom of the screen stating that the
project has been copied with a link to the new project. If you check the new copied
project, you will notice that it has all the configurations of the source project. This
tool takes less than a minute to run and JIRA administrators can save a lot of time
using it.
[ 211 ]
Escalation service
This is an excellent Built-in Script that helps JIRA administrators to perform
periodic actions on a certain set of issues. Let's take an example of a support ticket
configuration in which we have a workflow state called Waiting for Client in our
project. This is used to signify that further information is required from a client to act
further on a ticket. These issues need to be resolved automatically when the ticket is
not updated in the past 2 weeks:
1. Click on Escalation service:
[ 212 ]
Chapter 11
Now, we have a service added that will run after every 24-hour period and will
resolve the issues that were not updated in the past 14 days, that is, 2 weeks.
[ 213 ]
3. Click on the here link that appears at the bottom of the screen. You will then
be logged in with a different user:
This script is one of my favorites because I can log in with any username I want
without asking their password and it also saves a lot of time.
Conditions
Script Runner brings a set of additional conditions that you can add in the workflow;
it gives you an amazing control over a lot of things that was not possible earlier.
Perform these steps:
1. Modify the workflow of your choice. For any transition, navigate to Add
Condition To Transition.
2. You will find a new condition called Script Condition; select it and click
on the Add button:
[ 214 ]
Chapter 11
3. On the next screen, you will get a list of scripts that you can add as a
workflow condition:
[ 215 ]
Simply select the Resolution that you want your subtasks to match and click on the
Add button.
[ 216 ]
Chapter 11
For instance, if you want the transition to happen only when the assignee of the issue
is the currently logged in user and the due date is today, then add the assignee
= currentUser() and due = now() JQL Query and click on the Add button.
Optionally, you can also enter the specific issue id to preview this condition.
Just select In Progress from the drop-down list for Previous Status and check
whether this status is Immediately previous only, uncheck this option if it is any
other status and click on the Add button.
[ 217 ]
Just click on any of the example links and it can be added as a condition. For
instance, I added a condition that will check whether one of the issue attachments
is a PDF file or not. Click on the Add button to continue.
Validators
Just like additional conditions, Script Runner brings a set of additional validators
that you can add in the workflow; it gives you an amazing control over lots of
things that were not possible earlier. Perform these steps:
[ 218 ]
Chapter 11
1. Modify the workflow of your choice and for any transition, navigate to Add
Validator To Transition.
2. You will find a new validator called Script Validator. Just select it and click
on the Add button:
3. On the next screen, you will get a list of scripts that you can add as a
workflow validator:
[ 219 ]
Select all the Fields that you want to check for change and click on the Add button.
The fields visible here are only the ones that are part of the transition view for the
transition you are working on in the workflow.
This validator doesn't require any parameters to configure. Just click on the Add
button.
[ 220 ]
Chapter 11
Just click on any of the example links and it can be added as a validator. For instance,
if you want to enforce that the issue should have at least four subtasks, then click
on Has greator than two subtasks and modify Condition from 2 to 4, so finally, it's
issue.subTasks.size() > 4. Click on the Add button to continue.
[ 221 ]
Post Functions
Just like additional conditions and validators, Script Runner brings a set of additional
post functions that you can add in the workflow; it gives you an amazing control
over a lot of things that was not possible earlier. Perform these steps:
1. Modify the workflow of your choice and for any transition, navigate to the
Add Post Function To Transition.
2. You will find a new post function called Script Post-Function; select it and
click on the Add button:
[ 222 ]
Chapter 11
3. On the next screen, you will get a list of scripts that you can add as a
workflow post function:
[ 223 ]
From the list of examples, click on the Priority is Major link and a Condition will
be added. Now, whenever this condition is true during the workflow transition, the
post function will be executed. Click on the Add button to add the post function.
[ 224 ]
Chapter 11
Select Parent action as Done (41) and Resolution as Fixed. Click on the Add button
to add the post function.
There are numerous other post functions that can be used in the workflow. Using the
Script Runner add-on, a lot of flexibility and control can be added in the workflow to
perform actions that were not possible earlier.
The following query will return an issue with more than four comments:
issueFunction in hasComments('+5')
[ 225 ]
This query returns issues with comments from a specific user in the past 7 days:
issueFunction in commented("after -7d by ravisagar")
This query finds issues in the file that was attached by a specific user in the past 7 days:
issueFunction in fileAttached("after -7d by ravisagar")
Comparing dates
Issues can also be fetched by comparing their date fields, such as resolution date and
due date.
Use this query to return issues that were resolved later than their due date:
issueFunction in dateCompare("", "resolutionDate > dueDate")
The following query finds issues that were resolved within 1 week of their creation:
issueFunction in dateCompare("", "created +1w > resolutionDate ")
These are just some of the examples of additional JQL functions that you can use. For
the full list, I recommend you to refer to https://jamieechlin.atlassian.net/
wiki/display/GRV/Scripted+JQL+Functions.
Script Runner is personally my favorite add-on that I use with all of the JIRA
instances that I manage. It just gives so much power and control to effectively
manage various administrative tasks in JIRA. Apart from various built-in scripts,
which give administrators access to ready-to-use features, one can also write his/her
own script and use it to perform more advanced and complex tasks. This ability to
write scripts opens up a lot of possibilities to enhance the workflow and to add more
features in JIRA without developing an add-on.
[ 226 ]
Chapter 11
Summary
In this chapter, we discussed Groovy Script Runner, which is an amazing add-on to
perform complex customizations in the workflow, access powerful JQL functions,
and run various scripts that can be used by JIRA administrators to maintain the
instance efficiently. Script Runner is by far the most popular admin tool used by
JIRA administrators.
In the next chapter, we will discuss how to access the JIRA database directly to fetch
data. JIRA offers lots of good reports, but sometimes they are not good enough and
more insight is required. If you know the JIRA database schema and how to access
the database, then any data can be retrieved for further reporting purposes.
[ 227 ]
www.PacktPub.com
Stay Connected: