JQL Functions

The JQL function module allows your app to define custom JQL functions which appear built-in from the user's perspective. This means that they're visible in the query editor and show up in the autocomplete dropdown.

See the JQL search extensibility page for more information about the architecture of JQL functions.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "modules": {
    "jiraJqlFunctions": [
      {
        "name": "subquery",
        "arguments": [
          {
            "name": "query",
            "required": true
          },
          {
            "name": "offset",
            "required": false
          }
        ],
        "types": [
          "issue"
        ],
        "operators": [
          "in",
          "not_in"
        ],
        "url": "/compute-function",
        "key": "subquery-jql-function"
      }
    ]
  }
}

Properties

arguments
Type
Required
Yes
Description

The list of arguments that the function accepts.


key
Type
Max length
100
Required
Yes
Pattern
^[a-zA-Z0-9-]+$
Description

A key to identify this module.

This key must be unique relative to the add on, with the exception of Confluence macros: Their keys need to be globally unique.

Keys must only contain alphanumeric characters and dashes.

The key is used to generate the url to your add-on's module. The url is generated as a combination of your add-on key and module key. For example, an add-on which looks like:

1
2
3
4
5
6
7
8
9
{
    "key": "my-addon",
    "modules": {
        "configurePage": {
            "key": "configure-me",
        }
    }
}

Will have a configuration page module with a URL of /plugins/servlet/ac/my-addon/configure-me.


name
Type
Required
Yes
Description

The name of the function.


operators
Type
Required
Yes
Description

The list of operators the function can be used with.


types
Type
Required
Yes
Description

The list of field types the function can be used with.


url
Type
Format
uri-template
Required
Yes
Description

The relative URL of the endpoint in the app that will be called by Jira to compute the function result.

The argument sent to the endpoint has the following format:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

 {
   "precomputationId": ""
   "clause": {
     "field": "field name",
     "type": [
       "field type"
     ],
     "operator": "operator",
     "function": "function name",
     "arguments": {
       "value"
     }
   }
 }

The endpoint is expected to return the result in the following format:

1
2
3
4
5

 {
   "jql": "JQL fragment to use in place of the function clause"
 }
 

or error message:

1
2
3
4
5

 {
   "error": "Error message that will be displayed on the UI"
 }
 


Rate this page: