JQL expression editor and tester
This document describes the JQL expression editor and tester. It is available from the Link issues to current issue post-function only.
JQL expression editor
JQL expression features
The JQL expression editor has the ability to:
Check for syntax errors in the Nunjucks code
Colorize keywords, comments, variables and so on
The editor also provides advanced features, such as find and replace, that are available through keyboard shortcuts.
JQL expression editor keyboard shortcuts
You can use the following shortcut keys as an alternative to the mouse when working in this editor, while the cursor is active in the editor:Â
Command | Description | PC | Mac |
---|---|---|---|
| Opens the search box. Use /re/ syntax for regexp search |
|
|
| Post a search, finds the next occurrence of the search |
|
|
| Post a search, finds the previous occurrence of the search |
|
|
| Opens the Replace window. |
|
|
| Opens the Replace all window |
|
|
| Select the whole content of the editor |
|
|
| When multiple selections are present, this deselects all but the primary selection |
|
|
| Deletes the part of the line after the cursor. If that consists only of whitespace, the newline at the end of the line is also deleted. | Â |
|
| Deletes the whole line under the cursor, including newline at the end. |
|
|
| Delete the part of the line from the left side of the visual line the cursor is on to the cursor. | Â |
|
| Delete the part of the line from the cursor to the right side of the visual line the cursor is on. | Â |
|
| Undo the last change |
|
|
| Redo the last undone change |
|
|
| Undo the last change to the selection, or if there are no selection only changes at the top of the history, undo the last change. |
|
|
| Redo the last change to the selection, or the last text change if no selection changes remain. |
|
|
| Move the cursor to the start of the document. |
|
|
| Move the cursor to the end of the document. |
|
|
| Move the cursor to the start of the line. |
|
|
| Move to the start of the text on the line, or if we are already there, to the actual start of the line (including whitespace). |
|
|
| Move the cursor to the end of the line. |
|
|
| Move the cursor to the right side of the visual line it is on. | Â |
|
| Move the cursor to the left side of the visual line it is on. If this line is wrapped, that may not be the start of the line. | Â |
|
| Move the cursor up one line. |
|
|
| Move down one line. |
|
|
| Move the cursor up one screen and scroll up by the same distance. |
|
|
| Move the cursor down one screen and scroll down by the same distance. |
|
|
| Move the cursor one character left, going to the previous line when hitting the start of the line. |
|
|
| Move the cursor one character right, going to the next line when hitting the end of the line. |
|
|
| Move the cursor to the start of the previous word. | Â |
|
| Move the cursor to the end of the next word. | Â |
|
| Move to the left of the group before the cursor. |
|
|
| Move to the right of the group after the cursor. |
|
|
| Delete the character before the cursor. |
|
|
| Delete the character after the cursor. |
|
|
| Delete up to the start of the word before the cursor. | Â |
|
| Delete up to the end of the word after the cursor. | Â |
|
| Delete to the left of the group before the cursor. |
|
|
| Delete to the start of the group after the cursor. |
|
|
| Auto-indent the current line or selection. |
|
|
| Indent the current line or selection by one indent unit. |
|
|
| Unindent the current line or selection by one indent unit. |
|
|
| If something is selected, indent it by one indent unit. If nothing is selected, insert a tab character. |
|
|
| Swap the characters before and after the cursor. | Â |
|
| Insert a newline and auto-indent the new line. |
|
|
| Flip the overwrite flag. |
|
|
Â
Lookup user
By 29 April 2019, Atlassian will remove personal data from the API that is used to identify users, such as username
 and userKey
, and instead, use the Atlassian account ID (accountId
). These are the impacts on JMWE:
If the JQL in your existing "Link issue to current issue" post-functions are using the
username
or theuserkey
 they need to be replaced with theaccountId
.If you are adding/modifying the JQL in the Link issues to current issue post-function you should not anymore specify the
username
oruserkey
but only theaccountId
. For example, JQL return the issues assigned to a specific user
However, the accountId
is not obvious in Jira. You can use this Lookup user feature in the Nunjucks editor to find the accountId
of a user. To know the accountId
of a user:
Click on the Lookup user button
Select the user fromÂ
Search for user
Click on Insert accountId
JQL expression tester
The JQL expression tester lets you test your expression against any issue. You can quickly test and debug your expression and make changes without having to actually trigger the transition and/or look at the JMWE logs to see the result.
Using the JQL expression tester
After writing your JQL expression in the editor, click on Test JQL expression.Â
A window opens, asking you to input an issue to run the JQL expression against. The issue variable used in your annotations will point to this issue.
The transition variable will not reflect transition information during testing.
Testing your JQL expression
After selecting an issue against which the JQL expression should be tested, click on Test.Â
The following information will be displayed. This information can be used for debugging.
Message: Success/error message based on the test result.
Parsed JQL query: The parsed JQL query
Issues: The result of the JQL query which is an array of issues.
Example:
Test a JQL expression that fetches issues in a project that are assigned to the current user.
Add the Link issues to current issue post-function to a transition.
In the JQL editor, write the following lines of code:
project = TEST and assignee = {{currentUser.accountId}}
Â
Select maximum number of issues in
Max. Issues
.Click on
Test JQL expression
Type the Issue key of an issue.
Click on
Test.
The following result is displayed:
Â
Debugging your JQL expression
If you encounter an error during testing or your JQL expression doesn't seem to fetch expected results, you will need to debug your expression. The information displayed in the result panel aids in debugging the expression.
In the above example if you provided "=="
instead of "="
:
project = TEST and reporter == {{currentUser.accountId}}
Test the JQL expression, as explained above. The following result will be displayed.
Identify the problem, from theÂ
Message
 that displayed an error that, there is an error in the JQL queryCorrect the problem, by modifying the expression
project = TEST and reporter = {{currentUser.accountId}}
Â
Retest the expression, by clicking onÂ
Test again
 and verify the result in the template test panel.
On This Page
Â