Cascading JQL

Ron Grinfeld June 2, 2015

I have issue types named Test Cases. In those types I have a custom field named ‘Story’ which holds the keys for the related stories of a test case.

 Now, using JQL, I would like to search for all test cases that are related to Stories that are in openSprints() (‘Sprint in openSprints()’).

 

Any idea how I can achieve it (I have script runner installed as well).

 

In general, is there any JQL extension plugin that offers an ability to cascade JQL searches based on returned fields? 

3 answers

0 votes
Pablo Beltran
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 Leaders.
November 7, 2015

If it is for reporting purposes, then it should be trivial by using SQL for JIRA..

select * 
from ISSUES i inner join ISSUECUSTOMFIELDS cf on cf.STORY=i.KEY 
where i.JQL='Sprint in openSprints()'

how does the query above work?

  1. It fetches all the issues returned by the JQL query Sprint in openSprints()
  2. for each issue in (1) it will filter those having ISSUE.KEY=ISSUECUSTOMFIELD.STORY

just what you are looking for wink

Pablo Beltran
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 Leaders.
November 7, 2015

Oops again, if you want to see them as JQL then it is a bit more complex as the SQL query must return the key of the issue. Therefore the right JQL query would be: ============= issue in sql(" select i2.key from ISSUES i1 inner join ISSUECUSTOMFIELDS cf on cf.STORY=i1.KEY inner join ISSUES i2 on i2.id=cf.issueid where i1.JQL='Sprint in openSprints()' ") note please that a second ISSUE table has to be joined to the ISSUECUSTOMFILEDS in order to get the issue KEY from the ID.

0 votes
Ron Grinfeld November 5, 2015

I have issues wrapped under an Epic

Is there a programmatic way to read the list of issues from the epic object ? I cant find the reverse link (Epic -> child issue) that corresponds to the  "Epic Link" (Issue ->Epic).

0 votes
Christian Czaia _Decadis AG_
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 Leaders.
June 3, 2015

Out of curiosity, why don't you use the default issue links to link stories and test cases? That way you could easily use SR to search for those issues?

Cheers

Ron Grinfeld June 3, 2015

Well, the full story is that these issue types and cross relationship where created by synapseRT plug in, so it's out of my control and I'm only trying to utilize it.

Suggest an answer

Log in or Sign up to answer