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 the issues in the supplied projects, for example, project in projects("TEST", "DEMO")
.
This 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. A simple function makes it easier to explain the concepts without worrying much about the logic of what it...