Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Query for all issues with more than one component

Ravi Dandu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 3, 2019

Need a Jira Query for all issues which have more than one component.

 

Each EPIC has a list of components that it effects. I want to query for all issues with two or more components listed. These will need to be discussed across teams, hence the interest in them. 

2 answers

1 accepted

1 vote
Answer accepted
Deleted user
July 9, 2015

I answered my own issue after some trial and error. Apparently the clearTime() function also executes on the object you call it from in addition to returning a date value to be stored in a variable. I fixed my issue by cloning the date objects so that any changes I made would change the clone, not the original.

 

import com.atlassian.jira.issue.MutableIssue
 
use(groovy.time.TimeCategory) {
    MutableIssue issue = (MutableIssue) issue
    try{
        def date1 = issue.getDueDate().clone()
        def date2 = issue.getCreated().clone()
        def dueDate = date1.clearTime()
        def createDate = date2.clearTime()
        def duration = dueDate - createDate
        return "${duration.days}".toDouble()
        }
    catch(NullPointerException e) {
        return 0.toDouble()
        }
}
1 vote
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
July 9, 2015

clearTIme clears the time part on the object you you call it, and returns that, which I eventually worked out from http://stackoverflow.com/questions/6739561/groovy-date-cleartime-question

So your original code would modify the issue object in the current thread, but not actually store any changes to the database. 

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events