JQL (Jira): Issues containing Sub-tasks assigned to me - jira

How do I query issues that have sub-tasks assigned to me?
Resulting issues may or may not be assigned to me but they must contain sub-tasks within them which are assigned to me (currentUser()).

issueFunction in parentsOf("assignee = currentUser()")
This requires Adaptavist Scriptrunner to be installed.
You can find the documentation of further advanced JQL queries here: https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html

You can use the below JQL for getting all the sub-tasks assgined to you, even though the main task is assigned to someone else.
assignee = currentUser() AND type = Sub-task
The Issue link will be in the Summary field.
Summary field will be something like below
Issue-1234 / Sub Task Summary

Related

How to find Jira tasks with all sub-tasks 'done'

I want to use Jira Query Language to find the tasks which all their sub-tasks are in 'done' state.
Which query can I use for that?
This can be done with the Script Runner plugin and the linkedIssuesOf function.
issueFunction in parentsOf("status = Done")
issuetype in subTaskIssueTypes() AND status = Done
A simple way to do this is use the Basic search query and then switch to the Advanced view. Jira will auto fill in the JQL in the text box.
The URL for the above JQL is:
https://jira-domain-com/issues/?jql=issuetype%20in%20subTaskIssueTypes()%20AND%20status%20%3D%20Done
EDIT:
Yes I misunderstood your question. But now that I understand, I see that it is a near duplicate of this one: Find parents issues which contains subtasks with label
As #strantheman said, ScriptRunner allows you to do this:
issueFunction in parentsOf("status = Done")
Additionally you could use the REST API - get a list of all tasks and sub tasks and check if the subtasks are all done. But this will be quite a bit of coding.

How to find all Subtasks where parent is assigned to me

We're using Jira stories to cover specific areas of functionality that a team member owns.
We're using sub-tasks to create a dependency chain to show when all bugs and enhancements have been finished for a story.
I would love to be able to create a query that shows subtasks where parent assignee is current user. Is this possible?
Volodymyr's answer is close, but the correct query is actually this:
issueFunction in subTasksOf("assignee = currentUser()"))
Not with a standard JIRA JQL, but for JIRA server there are couple plugins that add handy JQL functions.
With ScriptRunner https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner:
type = sub-task and issueFunction in parentsOf("assignee = currentUser()"))

Jira - JQL "WAS" Operator

Im trying to search for all the issues assigned to an user, but no results are being returned and i cant figure out why.
My JQL is the following:
project = MYPROJECT and assignee was joaoalves
In the docs it says:
The "WAS" operator is used to find issues that currently have, or previously had, the specified value for the specified field.
(Note: This operator can be used with the Assignee, Fix Version, Priority, Reporter, Resolution and Status fields only.)
I have an issue assigned to the user joaoalves, but when i search with the JQL above no issues are returned.
But if run the following JQL the issue is returned:
project = MYPROJECT and assignee = joaoalves
Am i missing anything?
It works in my instance, and return issues that currently or previously assign to me. Which version of JIRA are you using?
Assignee was will return the issues which were previously assignee to tat user and current tickets which are present on that user.
Try in conjunction with the "DURING" clause and specify a timeframe. Like this -
project = MYPROJECT and assignee was joaoalves DURING ('2017-04-16 23:59', '2017-04-19 23:59')
See: https://confluence.atlassian.com/jiracore/blog/2015/07/search-jira-like-a-boss-with-jql
The was operator is looking for issues where the assignee was joaoalves but is currently not that user.

Jira Quick-filter to show all task with subtasks assigned to current user

Currently, I have a quick filter to show me my task that does this:
assignee = currentUser()
This works ok, but doesn't show me tasks that are assigned to someone else, but have subtasks assigned to me. Is it possible to make it show me both tasks assigned to me, and tasks that have subtasks assigned to me?
Create a filter for all of your subtask from the following JQL:
issuetype in subtaskIssueTypes() and assignee = currentUser()
Then, using Craftforge JQL Functions Plugin, use the following JQL to find their parents:
issue in parentIssuesFromFilter("filter name or its id")
The following query will return all parent tasks, which have sub-tasks assigned to the current user. (The parent task need not be assigned to current user)
issueFunction in parentsOf("assignee = currentUser() ")
Note: issueFunction requires the ScriptRunner plugin and it's not free.
In addition to #Kuf's answer, it's sometimes much simpler to write the whole thing in one query especially with Swimlanes or Quick-Filters in Greenhopper, rather than creating and saving custom filter.
For instance, to show Un-finished Issues or Sub-tasks in one quick-filter on Greenhopper:
status!=Closed or issue in parentIssuesFromQuery("issuetype in subtaskIssueTypes() AND status!=Closed ")
Navigate to Issues (in header) > Search for issues, then enter your search criteria.

List all JIRA tasks that are not blocked by other tasks

Using JIRA 4.4.3,
I've created a filter that list all the tasks that:
- The current user is assigned to;
- are Open;
- are not blocked by any other task.
To make it clear: the task that are ready for a user to work on.
We've installed the Craftforge JQL Functions plugin, and I've come with the following JQL query:
assignee = currentUser()
AND status in (Open)
AND issue NOT IN linkedIssuesFromFilter("All Issues", "Blocks", "Outward")
The problem is that when an issue that was blocking another issue is resolved, the "Blocks" link still exist -- and I don't want to delete it. But my query doesn't check if the linked issue is closed/resolved or not.
How can I add a condition "inside the IN statement" that will only return queries that are blocking the current task AND that are still OPEN.
Use this clause from http://www.j-tricks.com/jqlt-links-functions.html:
issue not in linkedIssuesInQuery("status = Open", "is blocked by")
If you have the ScriptRunner add-on, you can use it to do this:
resolution = unresolved AND assignee = currentUser() AND (issueFunction in linkedIssuesOf("resolution is not empty", blocks) OR issueFunction not in hasLinks("is blocked by"))
I've created a new filter named "All active issues" that list all issues that are open, in progress or re-openned.
And I've used that new filter in my query instead of "All Issues".
Seems solved :)

Resources