JQL - Select issues where no subtask is assigned to the current user

Anthony Sennett June 22, 2014

I would like to select all tasks assigned to the current user, where no subtasks are assigned to the current user. This will let me make a report that warns a developer if they are currently accountable for a functional user story, but not working on any technical subtasks related to it.

I thought it would be this (using the Scripted JQL functions):

assignee = currentUser() and (issueFunction in parentsOf("assignee != currentUser()"))

Unfortunately this subquery does not include unassigned subtasks, despite the assignee presumably being null in this case. I tried experimenting with multiple issueFunction clauses, but that seemed like a bit of a rabbit-hole when what I want is not that complicated.

An example of what I want in SQL would look something like this:

select distinct t.* from Task t join Subtask st using (t.Id = st.TaskId) where t.AssigneeId = CurrentUserId and st.AssigneeId != CurrentUserId

If you're a SO user, I also posted the question here. http://stackoverflow.com/q/24356644/614523

3 answers

1 accepted

1 vote
Answer accepted
Vijay Khacharia
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.
June 22, 2014

Can you try this?

issuefunction in parentsOf("assignee != currentUser() or assignee is empty") AND assignee = currentUser() and not (issuefunction in parentsof ("assignee = currentUser()"))

1 vote
Vijay Khacharia
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.
June 22, 2014

Hi Anthony,

Here is the JQL that would work. You can use an OR for assignee to include also the empty assignees.

issuefunction in parentsOf("assignee != currentUser() or assignee is empty") and assignee = currentUser()

Hope this helps.

Vijay

Vijay Khacharia
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.
June 22, 2014

Hi Anthony,

But this is what my query does. It checks if the subtasks have assignee not equal to current user and returns all the parents, and then i check for assignee of task to be the current user.

Is your requirement that none of the sub-tasks should be assigned to the current user?

Vijay

Anthony Sennett June 22, 2014
Thanks for your continued input. I don't think so. I have a task, and I am assigned to the task. The task has two subtasks. I am assigned to one subtask, and the other subtask has no assignee. Using your query the task will get returned, when I require it not to be.
Anthony Sennett June 22, 2014
Hi Vijay. Thanks you answer. Unfortunately that is not quite what I am looking for, as your query returns tasks that have a subtask that is assigned to the user. If the user is not assign to any subtask of his tasks, then the query should return, otherwise it should not.
Anthony Sennett June 22, 2014
Yes - none of the subtasks should be assigned to the current user.
Anthony Sennett June 22, 2014

If you add your answer to the SO question I shall also give you that karma ;)

Anthony Sennett June 22, 2014

Great that works. Thanks so much for your help. Edit your answer to be this and I'll mark it as correct.

Vijay Khacharia
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.
June 22, 2014

Probably you can add Karma here too :) on SO you already put the answer rite?

Anthony Sennett June 22, 2014

I did, but if you put yours I'll delete mine.

0 votes
Anthony Sennett June 22, 2014

If you add your answer to the SO question I shall also give you that karma ;)

Suggest an answer

Log in or Sign up to answer