Displaying Jira issues using Issue Navigator - jira

Below is simple Jira JQL search statement:
JqlQueryBuilder builder = JqlQueryBuilder.newBuilder();
builder.where().assignee().in("Dylan").and().unresolved();
Query query = builder.buildQuery();
Then we have search results:
SearchResults results = searchService.search(authenticationContext.getUser(),
query, PagerFilter.getUnlimitedFilter());
List<Issue> issues = results.getIssues();
Problem: I need to find issues, filter them using several criteria and show results to the user using standard Jira Issue Navigator window (I don't want to create my own velocity template for it). I know, that it is possible to link JQL query string safely to an existing URL that points at the Issue Navigator. The main problem is that I have to compare two date fields of the issue (due date and resolution) and such comparison can't be done with JQL. So, I can't write query entirely with JQL. I have to mix JQL with standard Java (for date comparison, which is no problem at all).
So, my MAIN QUESTION is this: then I have a list of issues List issues = results.getIssues(), is it possible to display them using Issue Navigator? And how?

Once you have the List issues you can create an array of Strings with the same size, and save all issues keys into this query result. Than, you can create a filter of the sort:
issueKey in (ABC-1,ABC-2,ABC-3,...)
or via URL:
https://your.jira.com/secure/IssueNavigator!executeAdvanced.jspa?jqlQuery=issuekey+in+%28%22ABC-1%22%2C%22ABC-2%22%29&runQuery=true&clear=true
Having said that, I'm not so sure you can't find an easier solution using a JQL query, what is it that you are trying to achieve? The basic JQL gives some date-search abilities:
resolutionDate < "2013/01/01" and duedate < now()
Have a look at JIRA's Advanced Searching for more information.
If the standard JQL isn't enough, check out existing plugins, such as JQL Tricks Plugin. Another option might be to create your own JQL search, check Adding a JQL Function to JIRA for more info about this solution.
Let me know if you need help and good luck!

Related

Jira query that returns all projects that have issue-link dependencies that display the linked-from and linked-to project name

Need to come up with a Jira query that returns all projects that have issue-link dependencies, that display the linked-from and linked-to project name
Jira cannot search for projects, it can search for issue only. However, you can put such search onto a dashboard, to Issue Statistics gadget and display the search result grouped by project.
Moreover, this cannot be searched by default JQL functions. You will need extra add-on to conduct such search. The best is ScriptRunner.
You can then conduct such search:
issueFunction in linkedIssuesOf("project = XXX", "linked-to")
or vice-versa:
issueFunction in linkedIssuesOf("project = XXX", "linked-from")
The first argument is a subquery of all issues you're interested in. The query will return all issues linked with that respective link type with subquery issues.
ScriptRunner JQL function documentation:
https://docs.adaptavist.com/sr4js/latest/features/jql-functions/included-jql-functions/issue-links#id-.IssueLinksv6.47.0-linkedissuesof

JQL Query - Use a filter result in another JQL query

I have a JQL filter searching for epics fulfilling certain requirements.
Now i would like to do something like:
"Epic Link" in (filter= 22611)
I know one can use filters with AND etc, but this doesn´t seem to work.
Is this even possible or is there another way round?
Thank you!
Nested JQL calls are not (yet) possible in Jira. Atlassian have a feature request raised for this here.
You will need to accommodate the JQL with the AND operator in front.

Jira Rich Filters widgets in Dashboards: query has length limitation

I am using Rich Filters in Jira. What I want is to create a Dashboard with Rich Filter Results widget. One of the fields of such a widget is JQL query used to fetch jira items. The problem is that query field has limited length - a restriction which I have never met before in Jira. My JQL is too long to be inserted into this field. I tried to find a way to use simple filter instead of JQL but failed.
Is there a way around this?
You can use a filter in your jql (see docs).
Create a filter with your long query and name it for example "myfilter"
In you widget type this jql: filter = "myfilter"

JQL actual "contains"

I want to perform a simple search on a text field with part of its content but I don't know the beginning. I basically want what someone would expect of a "contains search". If I search issue for 345, I would want this result:
123456
234567
345678
...
Which, in JQL, would be the result of the query issue ~ "*345*", but the * is not allowed as first character in wildcard query. Is there an easy way to get this result, preferably with a JQL query?
Right now it's impossible to search JIRA for contains operation. As described in Search syntax for text fields, JIRA support Word stemming:
Since JIRA cannot search for issues containing parts of words, word
'stemming' allows you to retrieve issues from a search based on the
'root' (or 'stem') forms of words instead of requiring an exact match
with specific forms of these words. The number of issues retrieved
from a search based on a stemmed word is typically larger, since any
other issues containing words that are stemmed back to the same root
will also be retrieved in the search results.
That means, that you can search for common root of some word, but can't search for arbitrary part of it.
There is an issue in official JIRA bug tracker: Allow searching for part of a word (prefix / substring searches), which describes why this can't be implemented:
Lucene doesn't support prefix search.
As a workaround the suggestion is to use Script Runner plugin for JIRA:
issueFunction in issueFieldMatch("project = JRA", "description", "ABC\\d{4}")
See more on IssueFieldMatch here.
Another plugin, which can do regex jql is JQL Search Toolkit.
Filter issues by "345" substring in the Summary field:
summary ~ "345"
Filter issues by "345" substring in the Description field:
description ~ "345"

Is there a way to retrieve all stories for any epic that contains a string in jira's jql?

I have a problem in which I need to generate a dashboard for a large feature which comprises multiple epics. I would like to be able to search for all of the stories, maybe even technical tasks as well, under any epics which contain the feature name and return this in a search. Is there a way to do this with Jira's JQL?
Sadly, you cannot reference fields as values or functions in JQL.
If you do something like description ~ summary, it will either throw an error, or automagically quote it as description ~ "summary" and search for the string literal "summary".

Resources