The jira:jqlFunction
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 functions page for more information about the architecture of JQL functions.
Property | Type | Required | Description |
---|---|---|---|
key |
| Yes | A key for the module, which other modules can refer to. Must be unique within the manifest. Regex: |
name | string | Yes | The name of the custom function. Must be unique and different from the names of built-in JQL functions. In case of name collision, the built-in function will be called. |
operators | list | Yes | List of operators supported by the custom function. The following operators are available:
|
types | list | Yes | Types of fields the custom function can be used with. The following types are available:
|
arguments | Argument | List of arguments for the custom function. | |
function | string | No | A reference to the |
endpoint | string | No | A reference to the Required if no |
Property | Type | Required | Description |
---|---|---|---|
name |
| Yes | The name of the custom function argument. |
required | boolean | Yes | Whether the argument is required. |
Manifest:
1 2modules: jira:jqlFunction: - key: issuesWithText-function name: issuesWithText arguments: - name: text required: true types: - issue operators: - "in" - "not in" function: functionKey function: - key: functionKey handler: index.issuesWithText
Function implementation example:
1 2export const issuesWithText = async (args) => { console.log('Hello from issuesWithText()'); const { clause } = args; const { operator } = clause; const [text] = clause.arguments; const jqlFragment = `summary${operator === 'in' ? ' ~ ' : ' !~ '}'${text}'`; return { jql: jqlFragment }; };
To learn more about Forge remote, see Remote essentials. There are a few caveats when using Forge remote (like Forge Invocation Token validation) that you have to consider when implementing the remote backend. However, in the context of JQL function business logic, everything described on the JQL functions page applies and your function should return a valid JQL fragment as a result of the processing.
Manifest example:
1 2modules: jira:jqlFunction: - key: remote-jql-function name: testRemoteJqlFunction arguments: - name: text required: true types: - issue operators: - in - not in endpoint: remote-jql-endpoint endpoint: - key: remote-jql-endpoint remote: remote-app route: path: /jqlfunction remotes: - key: remote-app baseUrl: "https://my-app-remote-example.com"
This is how to use the function in JQL:
1 2issue in issuesWithText("hello, world!")
Rate this page: