JQL Query Count Number of Times an Issue Has Been Rejected

Given an issue, can I write a JQL query that will return the number of times an issues has been rejected?

I'd appreciate it. 
Thanks,
Chris Mazzochi

3 answers

0 votes
Alexey Matveev Community Champion Dec 22, 2017

Hello,

It is not possible. JQL queries can return only issues, they can not return number of times.

How about the number of rejections per user for a given time period?

JQL finds issues.  It does not report on them.

You can create a scripted field as @Tarun Sapra suggested. You would need an additional add-on for it and do some coding but it is not connected to JQL. JQL just finds issues but  you can provide information about the issues in custom fields.

Thank you guys.  I will try the add-on/scripted field route. 

0 votes
Tarun Sapra Community Champion Dec 22, 2017

Hello @Chris Mazzochi 

Form your query it seems "Rejected" is a status. Basically JQL is used to fetch issues but it can't run aggregation/analytics on the data. You can query issue history using "WAS" / "During" / Changed keywords but it won't retrieve you the exact count.

You will need add-ons to achieve this. 

If you have script runner then you can have a scripted field which returns this value.

import com.atlassian.jira.component.ComponentAccessor

def theStatus = 'Rejected'
def changeItems = ComponentAccessor.changeHistoryManager.getAllChangeItems(issue)
def transitionsCount = changeItems?.findAll{it.field == 'status' && it.getTos().values().contains(theStatus)}.size()
return transitionsCount as Double

Thank you.  I will try this. 

I am querying this data from Klipfolio though. 

I forgot to mention that I am running these queries from Klipfolio.  So the add on solution doesn't apply.  I think the add on is for JIRA. 

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,811 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot