Writing a JQL function
As we have seen, a JQL function allows us to define custom expressions or searchers. JIRA has a set of built-in JQL functions, the details of which can be found at http://confluence.atlassian.com/display/JIRA/Advanced+Searching#AdvancedSearching-FunctionsReference. In this recipe, we will look at writing a new JQL function.
JQL functions provide a way for values within a JQL query to be calculated at runtime. It takes optional arguments and produces results based on the arguments at runtime.
In our example, let us consider creating a function projects()
, which can take a list of project keys and return all issues in the supplied projects. For example,
project in projects("TEST", "DEMO")
It will be equivalent to:
project in ("TEST","DEMO") and also to project = "TEST" OR project = "DEMO"
We are introducing this new function just for the sake of this recipe.
Getting ready
Create a skeleton plugin using the Atlassian plugin SDK.
How to do it...
JIRA uses the JQL Function Module...