Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JQL query for filtering all subtasks of specific tasks

Olga Wallace November 30, 2022

Hi All,

EDITED: How do I modify the filter below to show only Subtasks & parent Epics of Tasks called "change management task" (tasks should not be visible, only epics & sub-tasks).

project = RRP AND issuetype= task AND text ~"change management task" ORDER BY Rank ASC

5 comments

Comment

Log in or Sign up to comment
Matthew Chapman
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 30, 2022

Hi There, I think you might need to use AND issuetype= Sub-task to return only the sub-tasks you are looking for, cheers 

Olga Wallace November 30, 2022

it didn't work

Cengiz Akyildiz
Contributor
November 30, 2022

Hi,

I think you need something like this,

issue in subTaskOf("project = RRP AND issuetype= task AND text ~ \"change management task\" ") ORDER BY Rank ASC

 which is available with Scriptrunner!

Cheers

Like Darryl Lee likes this
Olga Wallace November 30, 2022

Sprictrunner is not an option unfortunately

Cengiz Akyildiz
Contributor
November 30, 2022

Then it is unlikely you can achieve what you trying to filter. If you can identify the the keys for those tasks then you may use something like this,

project = RRP AND parent in (<issuekey1>,<issuekey2>,...) ORDER BY Rank ASC
Like Haddon Fisher likes this
Haddon Fisher
Contributor
December 1, 2022

@Cengiz Akyildiz is correct as far as I know that there is no JQL functions out-of-box that let you do this kind of 'nested' or relational querying. The feature request is JRACLOUD-21936 for anyone who wants to add their howls to the void.

However if you are willing to use a custom field and Automation, you could set a flag if\when the parent has "change management task" in the title and search for sub-tasks with the flag set. 

Like # people like this
Cengiz Akyildiz
Contributor
December 1, 2022

If you list down your existing add-ons you have that might with, we can suggest some other solutions using your existing add-ons. As people suggested here automation can help you out to tag your subtasks. 

Possible methods for example:

  • If you have A4J, you can set a label, flag or any other type custom field for this, which you can search on that field
  • or If you have JMCF, you can create a calculated field similarly
  • or if you have Workflow add-ons (like JMWE, JWT,JSU), you might be able set a similar field within the workflow of subtasks.
  • you can also write a listener using (MyGroovy - free) to set again that custom field.

But those are all based on having a custom field that will be set through various automation tools listed here (there are more than you think actually)

But again the simplest way is to have a JQL function that provides you the set of sub-tasks given the nested criteria. Not necessarily SR4J, there might be some other cool add-ons, there are new add-ons coming up on the Marketplace, which you might be able use it for free. 

Like # people like this
Cengiz Akyildiz
Contributor
December 1, 2022

Ooh nice I've just realized MyGroovy support scripted fields also. But you know Jira Server is sunsetting, you gotta test it in DC. 

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 1, 2022

Oh wow I did not know about MyGroovy, but um, this was posted in Jira Cloud Admins, so might not be applicable? :-/

Cengiz Akyildiz
Contributor
December 1, 2022

Ooh totally you are right, I forgot for a moment which environment is the issue for.

Mani
Contributor
November 30, 2022

Hi, Check below if that helps!

#if you multiple parent task with similar summary
project = RRP AND issuetype = Sub-Task AND text ~ \"change management task\"

or
#if you have single parent task number 

project = RRP AND issuetype = Sub-Task AND "Parent Link for Task" = "issue-key" AND text ~ \"change management task\"

or
#if you have multiple parent task number 
project = RRP AND issuetype = Sub-Task AND "Parent Link for Task" in (issue-key, issue-key) AND text \"change management task\"

Olga Wallace November 30, 2022

it doesn't like the statment project = RRP AND issuetype = Sub-Task AND text ~ \"change management task\"

 

Screenshot 2022-12-01 014646.png

Radka Svobodova
Contributor
November 30, 2022

Hi, it won't be working as you expect either way without some add on for extended JQL queries. In the basic jira query you can not filter subtasks of parent/s defined by another query.

Either You need some add on for it or you need to divide the query to two steps and manually change it always when you need it (not useful for dashboards with automatic updates). The first you need to find all the parent issue with the text - anotation is: text~"change management task", and it will find all the parent issues, you tak list of the found issue keys and make a second query with them in parenthesis: issuetype = Subtask AND parent in (PRP-1, PRP-2...)

 

Workaround could be use the automation to put labels to the subtasks and than make query based on subtasks issue type and the lable

Like # people like this
70
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!
December 1, 2022

I think because you are escaping the quotations in your JQL it is taking /"change as a term and expecting another key word after it, try:

project = RRP AND issuetype = Sub-Task AND text ~"change management task"
Olga Wallace December 1, 2022

thank you fot the suggestion, the query will not work because there are no sub-tasks called "change management task" 

Syed Muhammad Umair Mansoor
Contributor
December 1, 2022

Hi, Try this:
project = RRP AND issuetype= task AND parent in (issue-key) AND issuetype in (epics, sub-tasks)

Olga Wallace December 1, 2022

replaced (issue-key) with the actual issue id, no issues were found to match the search

Radka Svobodova
Contributor
December 1, 2022

yes because this query makes itself never match - you want all issues that are at the same time type "task" and "epics or subtasks", so from that query delete <AND issuetype= task> and epics wont be found with this query, because it wont fit <parent in>, you need to divide search for subtasks and for epics with <OR>

 

(project = RRP AND parent in (issue-key) AND issuetype = sub-tasks) OR (project = RRP AND  parentEpic = (issue-key))

Like Kalin U likes this
S Fong
Contributor
December 2, 2022

What is the issue key and issue type for "change management task"?  I am assuming that the issue type is the parent of the subtasks that you are trying to query on.  

 

Try this:

project = PRP AND issuetype = "Sub-task" and "Parent Link" in (Issue Key)

 

where Issue Key is the parent issue of the "change management task"

S Fong
Contributor
December 2, 2022

It works on mine when I tried to pull the sub-tasks of a specific parent link or multiple as well.

TAGS
AUG Leaders

Atlassian Community Events