Jira JQL operator and + and + and - jira

please I want to create a filter of custom statuses, but somehow when I press search I will get no results. When I search only for one status all is fine, but I want to merge that somehow into one filter. Or is there any way to get a exact number of tasks in any kind of status, assigned to the user? Im using the pie chart and want to see the number of all tasks assigned for any guy in the team, no matter the status. And I want to have it in a gadget. Thanks
Code Im using is:
project = "XYZ" AND status = "To Do" AND status = "Awaiting Approval"
AND status = "In Progress"

Have you looked at the 'in' operator?
...AND status IN ('To Do','Awaiting Approval','In Progress')

A Jira ticket cannot have more than one status at the time. I would do something like this
project = "XYZ" AND status IN ("To Do", "Awaiting Approval", "In Progress")

The other answers are definitely the correct way to write the JQL you were aiming to write, however I believe there is a better solution to your actual aim.
From what I understand, you want to see any Jira issue which is not closed and is assigned to a particular user. In this case I think the best solution would not to find all issues in the specific "open" statuses, but instead to find all which are not closed.
The best way to do this is by filtering by the status-category, as this will ensure the JQL works for all workflows, regardless of what their done/closed statuses are called.
statuscategory != done AND assignee=<user>
Replace <user> with the user you want to filter for, or currentUser() to automatically get the user who is running the query.
Documentation (only mentioned briefly): https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-fields/#Advancedsearchingfieldsreference-ResolutionResolution

Related

Query/filter to return child issues from a list of active parents (EPICs)

I'm looking for a JQL query/filter to return a list of child issues from a list of active parents (EPICs).
For example:
"Epic Link" IN linkedIssuesInQuery("issueType = Epic AND Status = 'In Progress'")
I was hoping the above query would work, but the results are not what I expected. Is there a way in standard JIRA (no plugin) to return a list of all child issues of a Query/Filter set?
I also tried a filter, but the results were the same as above:
"Epic Link" IN linkedIssuesInFilter("1234")
// Where Filter Id 1234 was something like => issueType = Epic AND Status = 'In Progress'
Both examples above return results, however they seem to be incomplete results and I don't understand why some issues not not being returned.
ps. The function childIssuesOf("ABC-123") returns the correct results for a single parent issue, but how do I provide a dynamic list of parents, not just a static hardcoded issue number?
EDIT:
After a lot more experimenting and reading, I found that the JIRA instance I am using has a Plugin called JQL Tricks. This Plugin has a function which, based on its description, is exactly what I need: parent(JqlQuery) ... but it doesn't work!
Here is my test query:
issue in parent("project in (MyProject) and status = \"In Progress\" and issueType = EPIC")
This query returns 0 results! However when I cut out the JqlQuery within parent and run it on its own, I get the complete list of EPIC's I expect to see and when I review the EPIC's they all have child issues. From all the experimenting I have done with this function, I believe there is an issue with the status "In Progress" (and also "Open") as when I try the call with other status types the child issues are return as expected. I have also tried a different approach for filtering for In Progress
issue in parent("project in (MyProject) and status not in (closed, refused, new, open) and issueType = EPIC")
However the result is exactly the same as above, 0 results!
Finally I have also experimented with the function subtask(JqlQuery), also without success.
Can anyone help?
In JQL Tricks, parent and subtask JQL functions work with parent/child (subtask) link type. You might want to search for "issues in Epic" link type, i.e. using the "Epic Link" field.
With JQL Tricks you can try this (be careful about different quotation marks):
issue in issuesWhereEpicIn('project in (MyProject) AND status = "In Progress"')
Source: https://www.j-tricks.com/jql-tricks-plugin.html [1, 2]
Tip: (mainly for other users ended here finding the same answer)
You can also check if ScriptRunner add-on is installed (it's very often installed, too). You can check the presence if issueFunction is available in JQL). With this add-on, you can use this:
issueFunction in issuesInEpics('project in (MyProject) AND status = "In Progress"')

Nested Jira Search on two independent projects

I need to get a nested Jira search. I am okay with JQL query but I have a usecase that I don't know how to solve
Company uses project=XTBOW for reporting purpose for executives (Epic)
The company also uses project=XTA for underling development work (Task)
The XTA task are linked to the XTBOW Epic for a subset of task, but not all. (There is a large body of XTA task that are not linked to XTBOW)
I need to get a filter going for all XTA projects that are linked to XTBOW Epics only. I would like to use a filter like this:
project = XTA and "Epic Link" in (<project = XTBOW.key>)
I can manually prove this filter works. But need a way to automate this filter, because the number of tickets being created/tracked in growing exponentially, and if someone deletes a key for XTBOW that is in the "Epic Link" field, the JQL search throws and error because the "Key" is missing.
Example - FYI cf[10231] is the "Epic Link" field:
project in (XTA,XTWOF) and cf[10231] in (XTBOW-42,XTBOW-59)
The overall objective is to download the data to a dataframe. So if there is a better suggestion to even avoid JQL and do it through python. I am all ears. Just need so pointers to start. I am just going this route because I have already built a JIRA-Downloader/Parser using Python.
The easiest way to get subsets of issues is with:
search_issues(jql_str, startAt=0, maxResults=50, validate_query=True, fields=None, expand=None, json_result=None)
You should be able to just pull the issue sets using the queries you already created, just make them into strings.
DOC

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 :)

List of all jira tasks that I was assigner on

How can I get list of all tasks that I was assigned?
I just need to know all the tasks despite its current status or assignee.
Is it possible?
So here the answer to the changed question (tasks that I was assigned to):
Depending on the version of JIRA, you are now able to asked questions that go into history. See the example in the documentation and the documentation about the "WAS operator".
Your query should look like:
assignee WAS "wormhit" BEFORE "02/02/2011"
If you want to store your search (not the result), there are the following options:
Define your own filter by saving a search like the one as "Own issues". Steps:
Search > Edit > Issue Attributes > Assignee > Current User
Switch on the top to tab Summary
Under Operations, press Save it as filter
Give it meaningful name.
The filter is now available under Issues > Favorite Filters
You may store the shortcut for the search as a bookmark
General-purpose query for whichever 'current user':
assignee was currentUser()
This filter can be conveniently shared & anybody can put it on their dashboard, etc and it will return results specific to them.. Requires a not-too-old JIRA version, though.
This was my most-requested JIRA feature ever.
Yes. You can add a gadget "my tasks" to your dashboard.
Or you can use JQL like:
assignee = %yourname%
UPD To find tasks you WAS assigned, use JQL: "assignee was %username%"
By following this discussin I stumbled on HP/Palm Jira Search Plugin that can find what I'm looking for.
Go like this:
Issues -> search for issues -> Issue atrributes -> Assignee -> Current User -> Search

Resources