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 vote
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 Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

228 views 1 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