Autocomplete for parameters in JQL functions

Amit Narayanan February 23, 2012

Is there a way to have JQL functions auto-complete parameters?

Take the hypothetical example of a custom JQL function such as {{reporter in timeZone("")}} to list all issues reported in a particular timezone. Instead of having a user figure out and manually enter the hieroglyphics to specify a Java timezone, can JIRA offer up the list of timezones as simple auto complete options?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Deniz Oğuz
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.
January 3, 2014

Hi Amit

Could you find out how to enable autocomplete for custom JQL functions?

Deniz Oğuz
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.
January 3, 2014

Javascript side of auto complete function does not send any query to serverside so implementing only ClauseValuesGenerator will not help.

0 votes
MattS
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.
February 26, 2012

JIRA does this for select lists, so I assume that the SelectSearcher has something about it. Comparing it to TextSearcher I see that JqlSelectOptionsUtil is used and looks like a possible example.


~Matt

Amit Narayanan March 16, 2012

Ack, I completely missed your response to this.

I'll take a look at the suggested SelectSearcher, TextSearcher, and JqlSelectOptionsUtil classes and share any interesting findings.

MattS
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.
August 13, 2012

It looks like the JQLAutoComplete.js code calls the REST resource /rest/api/1.0/jql/autocomplete which is a defined in

./jira-project/jira-components/jira-plugins/jira-rest-plugin/src/main/java/com/atlassian/jira/rest/v1/jql/AutoCompleteResource.java

The method getAutoCompleteResultsForField then calls a specific ClauseHandler, which was defined in the Searcher for the field. For versions the class is VersionClauseValuesGenerator

MattS
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.
August 13, 2012

The classes that generate the values all implement this interface

http://docs.atlassian.com/jira/4.4/com/atlassian/jira/jql/values/ClauseValuesGenerator.html

If you're considering doing your own autocompletion, you have to change the searcher for your custom field to use such a class. The only context when making the choice about what to return are the following parameters

* @param searcher the user preforming the search.

* @param jqlClauseName the jql clause name that was entered by the user, represents the identifier that was used

* to find this values generator. Note: for custom fields this can be used to identify the custom field we are

* dealing with.

* @param valuePrefix the portion of the value that has already been provided by the user.

* @param maxNumResults the maximun number of results to return.

TAGS
AUG Leaders

Atlassian Community Events