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 and Target issues section of all post-functions that operate on related issues when Issues returned by a Groovy script or Issues returned by JQL search is selected under Which Issues field.

On this page:

JQL expression editor

JQL expression editor toolbar

The JQL expression editor has a toolbar with the following features. Clicking on:

  • Find: Opens the search box. Use /re/ syntax for regexp search
  • Find Next: Finds the next occurrence of a search
  • Replace: Opens the Replace window. Replace a certain text with a specified text
  • Test JQL search: Opens the Test JQL window to input the Issue key. Use it to test your JQL expression.
  • Test again: Retests your JQL expression

The shortcuts for Find, Find Next and Replace are shown in the table below.

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 a code editor: 


Opens the search box. Use /re/ syntax for regexp search

findNextPost a search, finds the next occurrence of the searchCtrl-GCmd-G
findPrevPost a search, finds the previous occurrence of the searchShift-Ctrl-GShift-Cmd-G

Opens the Replace window.

replaceAllOpens the Replace all windowShift-Ctrl-RShift-Cmd-Alt-F
selectAllSelect the whole content of the editorCtrl-ACmd-A
singleSelectionWhen multiple selections are present, this deselects all but the primary selectionEscEsc
killLineDeletes 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.
deleteLineDeletes the whole line under the cursor, including newline at the end.Ctrl-DCmd-D
delWrappedLineLeftDelete the part of the line from the left side of the visual line the cursor is on to the cursor.
delWrappedLineRightDelete the part of the line from the cursor to the right side of the visual line the cursor is on.
undoUndo the last changeCtrl-ZCmd-Z
redoRedo the last undone changeCtrl-YShift-Cmd-Z or Cmd-Y
undoSelectionUndo the last change to the selection, or if there are no selection only changes at the top of the history, undo the last change.Ctrl-UCmd-U
redoSelectionRedo the last change to the selection, or the last text change if no selection changes remain.Alt-UShift-Cmd-U
goDocStartMove the cursor to the start of the document.Ctrl-HomeCmd-Up or Cmd-Home
goDocEndMove the cursor to the end of the document.Ctrl-EndCmd-End or Cmd-Down
goLineStartMove the cursor to the start of the line.Alt-LeftCtrl-A
goLineStartSmartMove to the start of the text on the line, or if we are already there, to the actual start of the line (including whitespace).HomeHome
goLineEndMove the cursor to the end of the line.Alt-RightCtrl-E
goLineRightMove the cursor to the right side of the visual line it is on.
goLineLeftMove 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.
goLineUpMove the cursor up one line.UpCtrl-P
goLineDownMove down one line.DownCtrl-N
goPageUpMove the cursor up one screen and scroll up by the same distance.PageUpShift-Ctrl-V
goPageDownMove the cursor down one screen and scroll down by the same distance.PageDownCtrl-V
goCharLeftMove the cursor one character left, going to the previous line when hitting the start of the line.LeftCtrl-B
goCharRightMove the cursor one character right, going to the next line when hitting the end of the line.RightCtrl-F
goWordLeftMove the cursor to the start of the previous word.
goWordRightMove the cursor to the end of the next word.
goGroupLeftMove to the left of the group before the cursor. Ctrl-LeftAlt-Left
goGroupRightMove to the right of the group after the cursor.Ctrl-RightAlt-Right
delCharBeforeDelete the character before the cursor.Shift-BackspaceCtrl-H
delCharAfterDelete the character after the cursor.DeleteCtrl-D
delWordBeforeDelete up to the start of the word before the cursor.
delWordAfterDelete up to the end of the word after the cursor.
delGroupBeforeDelete to the left of the group before the cursor.Ctrl-BackspaceAlt-Backspace
delGroupAfterDelete to the start of the group after the cursor.Ctrl-DeleteCtrl-Alt-Backspace or Alt-Delete
indentAutoAuto-indent the current line or selection.Shift-TabShift-Tab
indentMoreIndent the current line or selection by one indent unit.Ctrl-]Cmd-]
indentLessDedent the current line or selection by one indent unit.Ctrl-[Cmd-[
defaultTabIf something is selected, indent it by one indent unit. If nothing is selected, insert a tab character.TabTab
transposeCharsSwap the characters before and after the cursor.
newlineAndIndentInsert a newline and auto-indent the new line.EnterEnter
toggleOverwriteFlip the overwrite flag.InsertInsert

A group is a stretch of word characters, a stretch of punctuation characters, a newline, or a stretch of more than one whitespace character.

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 the Test JQL search button on the toolbar. A modal dialog window opens, asking you to pick an issue to run the JQL expression against. You can include Groovy template in your JQL expression. 

Selecting an issue

You can select the issue from one of the following options:

  • Issue key: start typing an issue key, you will be offered options based on your issue browsing history
  • [Select issue]: if you click on [Select Issue], an Issue selector window gets displayed. You can select the issue either from:
    • Recent Issues: Displays issues that you have recently viewed and first 50 issues from your current search or
    • From Filter: Displays issues of your saved searches.

The issue variable used in your Groovy template will point to this issue.

Testing your JQL expression

After selecting issue(s) against which the JQL expression should be tested (as explained above), click on Test. The following information will be displayed. This information can be used for debugging.

  1. Message: Success/error message based on the test result.

  2. Actual JQL search: The actual search

  3. Issues returned by your searchThe result of the JQL query which is an array of issues.


Test a JQL expression that fetches issues whose assignee and reporter are same

  1. Add the Set field value post-function to a transition.
  2. In the JQL expression editor and tester#JQL expression editor, write the following lines of code:

    project = TP and reporter = <%= issue.get("assignee").getName() %>
  3. Click on Test JQL search icon on the toolbar.
  4. Select an Issue key. The issue you pick must have a valid Assignee.
  5. Click on Test
  6. The following result is displayed:
  7. For the same script, select an issue which is unassigned and test the result (Repeat steps 4,5 and 6). Since the issue is unassigned, a null pointer exception occurs.

Debugging your script

If you encounter an error during testing, you will need to debug your script. The Message, Stack and Log information displayed in the JQL expression tester result panel aids in debugging the expression.

Using the Message and Stack trace

In the above example, after testing the script against an issue that is unassigned:

  • Identify the problem, from the Message that displayed a null pointer exception error and the Stack that displayed the line number on which the error occurred.
  • Correct the problem, using the safe navigation operator ? that avoids the null pointer exception.

    project = TP and reporter = <%= issue.get("assignee")?.getName() %>
  • Retest the expression, as explained above and verify the result in the expression test panel. The result value will be null