How do I create custom JQL functions with ScriptRunner?

Richard Cross
Contributor
August 13, 2018

Is there a step-by-step guide to doing this? 

I had a look at https://scriptrunner.adaptavist.com/latest/jira/custom-jql-functions.html but it seems incomplete as the "Script JQL Functions" page in JIRA is non-interactive and simply contains a list of provided functions.

1 answer

0 votes
Alexey Matveev
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, 2018

Hello,

What other questions do you have? You need to create a script and then put it into the com.onresolve.jira.groovy.jql folder, which you have to create under the scripts folder. Maybe you will need to restart Jira. That is all.

Erik Gotera September 13, 2018

Hello Alexey,

Where is the scripts folder?

Thanks,

Alexey Matveev
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.
September 13, 2018

You can read about the scripts folder here:

https://scriptrunner.adaptavist.com/5.4.12/jira/#_script_roots

By default it is JIRA_HOME/scripts

Like Erik Gotera likes this
nallu March 7, 2019

Hi @Alexey Matveev , 

I want to write a JQL function that can be reused for more than one custom fields. Is that possible? 

For a instance:

I have written a JQL function to do a history search on a custom field "Target GA Release". I named the function as TargetGAReleaseChangedTo(). This function will behave similar to JQL 'fixVerrsion changed To 10.1'. This function will only work for Target GA Release field. 

 

But, I want to write a generic method 'Change To' which can be used for multiple custom field. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events