Forums

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

Jira Search Omitting Parent

Jeff Shepherd
Contributor
July 27, 2021

I have a list of tasks. Some have sub-tasks. How do I list all tasks omitting the parent tasks? For example:

assignee = currentUser() AND (IS NOT parent)

 

2 answers

2 accepted

2 votes
Answer accepted
Jeff Shepherd
Contributor
July 27, 2021 edited

To summarize the (above) discussion, what I want can't easily be done with the Jira queries at present.

It looks like a combination of the following two queries could accomplish what I want:

  • List my subtasks (issuetype in subTaskIssueTypes())
  • List my issues with no subtasks (can't be done at this time)

Thank you to @Jack Brickey and @Nic Brough -Adaptavist- for your help on this!

2 votes
Answer accepted
Nic Brough -Adaptavist-
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.
July 27, 2021

assignee = currentUser and issuetype in subTaskIssueTypes()

should do the trick.  Strictly, it's not what you're really asking, but it will give you the right answer.

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 27, 2021

And if you happen to want to include issues without subtasks…

assignee = currentUser and (issuetype in subTaskIssueTypes() OR issueLinkType is EMPTY)

Like • Jeff Shepherd likes this
Jeff Shepherd
Contributor
July 27, 2021 edited

Thank you, Jack!

Getting closer.

Here is the query I'm currently using. It still seems to be missing my top-level stories

assignee = currentUser() and (issuetype in subTaskIssueTypes() OR issueLinkType = EMPTY) AND resolution = Unresolved

 

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 27, 2021

Unsure why story 2 would be assigned to you if no action required by you. But that is a horse of a different color.

In any event, you could not achieve the goal with native JQL. Maybe Scriptrunner and Nic can likely assist there if SR is an option.

Jeff Shepherd
Contributor
July 27, 2021

(Sorry, I'm trying to edit my replies so the threads make sense. I think I'm just making a mess of it)

My issue is a bit more complicated than the example. Story 2 is assigned to and there are many subtasks assigned to multiple people. I still need to herd the cats, but want a query for the times when I just need to look at my action items

Jeff Shepherd
Contributor
July 27, 2021

Nic and Jack, you've got me on the right track. I think. I've found the following documentation and I hope I can find the query fields I want.

https://support.atlassian.com/jira-work-management/docs/advanced-search-reference-jql-fields/

I'll post a solution to my own question when I find it (hopefully).

Jeff Shepherd
Contributor
July 27, 2021

Hmmm... I'm having problems with issueLinkType. There seem to be outstanding bugs

issueLinkType = EMPTY is not working the way I think it should (to find an issue without a subtask) or I am misunderstanding something.

The following ticket seems to indicate problems finding issues without subtasks:

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 27, 2021

Ugh…. My bad @Jeff Shepherd I have totally gone astray here while answering multiple questions. IssueLinkType is for links not sub-tasks. 😖

my sincere apologies!

You can leverage "Parent Link" is empty

Jeff Shepherd
Contributor
July 27, 2021

@Jack Brickey,

I can find my subtasks with (issuetype in subTaskIssueTypes()).

What I need now is to find my issues without subtasks.

Parent seems to be a search that helps find a subtask.

Nic Brough -Adaptavist-
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.
July 27, 2021

Do you mean you need a clause like "issue has no sub-tasks"?

Like • Jeff Shepherd likes this
Jeff Shepherd
Contributor
July 27, 2021

Yes! 

Nic Brough -Adaptavist-
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.
July 27, 2021

Sorry, I was quite blunt there, I was trying to avoid an if/then/else essay that you only needed about 5% of!

There isn't a simple way to do this in Jira server I'm afraid.  You need one of the apps that can provide advanced JQL (functions usually).  Or something that can do "count sub-tasks" as though it's a field, so you can then use a clause like "and this issues subtask count is empty or 0"

Like • Jack Brickey likes this
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 27, 2021

There is this request you may wish to vote/watch - JRACLOUD-67108 

Jeff Shepherd
Contributor
July 27, 2021

No offense taken. The exclamation was excitement, not irritation.

While I'd rather have a "here is your solution" answer, an "it can't be done" is an answer too. At least I'm not left hanging.

Thank you for your attention to my question.

Suggest an answer

Log in or Sign up to answer