Help with this JQL query.

Am running this JQL

project = ABC AND issuetype in (Parent, subtask) AND issuefunction in hasSubtasks() OR issueFunction in subtasksOf("project in ('ABC')") AND "User Picker" = user1  ORDER BY issuekey ASC.

and i get parent and subtask which has a user picker value as user1 and also it returns issues with user2 user3 and user4. how can i make this effective to pull only issues related to user1?

User picker custom filed is only on subtask screen but not in the parent, by doing that JQl i get subtask and its associating parent.

any thoughts? 

Thank you

2 answers

1 accepted

1 votes
Alexey Matveev Community Champion Dec 21, 2017

Hello,

What do you mean by issues with user2, user3 etc. You mean that user2 is in the User Picker field for the issue?

When issue is created user must be selected from that picker and depending on other options available in issue user changes. Now i want to pull parent and subtasks based on user selection from picker user1 or user 2 or user3. So yea user2 is in the picker and user 2 and user 1 will not be on same issue

Alexey Matveev Community Champion Dec 21, 2017

Try like this

project = ABC AND issuetype in (Parent, subtask) AND (issuefunction in hasSubtasks() OR issueFunction in subtasksOf("project in ('ABC')")) AND "User Picker" = user1  ORDER BY issuekey ASC

Ignacio Pulgar Community Champion Dec 21, 2017

The JQL by Alexey is the one you need.

It was a matter of parenthesis; all you put after an OR do not take into account previous clauses, so it usually requires to carefully enclose something between parenthesis.

 JQL works fine and it pulls subtask with user1 but how can i make that jql also pull parent?

Alexey Matveev Community Champion Dec 22, 2017

It would be something like this

project = ABC AND issuetype in (Parent, subtask) AND (issuefunction in parentsOf("\"User Picker\" = user1") OR (issueFunction in subtasksOf("project in ('ABC')") AND "User Picker" = user1))  ORDER BY issuekey ASC

Yep. This works as expected. Thank you, Alexey.

Can you try with this JQL: 

project = ABC AND issueFunction in parentsOf("project=ABC AND \"User Picker\" = user1") and AND "User Picker" = user1  ORDER BY issuekey ASC.

Here you will get parent issues which has subtasks with user1 "user picker" value including the subtasks.

if you want to query for only parent issues, then try:

project = ABC AND issueFunction in parentsOf("project=ABC AND \"User Picker\" = user1")  ORDER BY issuekey ASC.

Hi Patina

Your JQL has no error but won't return any results. Thanks for spending time on my question.

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,815 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