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

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 help to find the issues of current month based on shift wise(6am to 3pm).???

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

73 views 0 5
Read article

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