Help with this JQL query.

KRC December 21, 2017

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
Answer accepted
Alexey Matveev
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.
December 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?

KRC December 21, 2017

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
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.
December 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
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.
December 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.

KRC December 22, 2017

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

Alexey Matveev
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.
December 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

KRC December 22, 2017

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

HarshaVardhan July 5, 2018

can you help to find the issues of current month based on shift wise(6am to 3pm).???

0 votes
rambabu patina
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.
December 21, 2017

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.

KRC December 22, 2017

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