---
title: "JQL expression editor and tester"
canonical: "https://support.appfire.com/space/JMWE/461439080/JQL%20expression%20editor%20and%20tester"
format: markdown
---
> Macro (aura-html)

<span style="color: #172b4d">This document describes the JQL expression editor and tester. It is available from the </span>*Link issues to current issue*<span style="color: #172b4d"> post-function and </span><span style="color: #172b4d">Target issues</span><span style="color: #172b4d"> section of all post-functions that operate on related issues when </span><span style="color: #172b4d">Issues returned by a Groovy script</span><span style="color: #172b4d"> or </span><span style="color: #172b4d">Issues returned by JQL search</span><span style="color: #172b4d"> is selected under </span><span style="color: #172b4d">Which Issues</span><span style="color: #172b4d"> field.</span>

**On this page:**


### **JQL expression editor**

#### **JQL expression editor toolbar**

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

- **Find:** <span style="color: #000000">Opens the search box. Use /re/ syntax for regexp search</span>
- **Find Next:** F<span style="color: #000000">inds the next occurrence of a search</span>
- **Replace:** <span style="color: #000000">Opens the </span>*Replace*<span style="color: #000000"> window. </span><span style="color: #000000">Replace a certain text with a specified text</span>
- **Test JQL search:** Opens the Test JQL window to input the Issue key. Use it to [test your JQL expression](#JQLexpressioneditorandtester-TestingyourJQLexpression).
- **Test again:** [Retests your JQL expression](#JQLexpressioneditorandtester-TestingyourJQLexpression)

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

#### **JQL expression editor k****eyboard 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: 

| **Command** | **Description** | **PC** | **Mac** |
| --- | --- | --- | --- |
| `find` | <span style="color: #000000">Opens the search box. Use /re/ syntax for regexp search</span> | `Ctrl-F` | `Cmd-F` |
| `findNext` | <span style="color: #000000">Post a search, finds the next occurrence of the search</span> | `Ctrl-G` | `Cmd-G` |
| `findPrev` | <span style="color: #000000">Post a search,</span><span style="color: #000000"> finds the previous occurrence of the search</span> | `Shift-Ctrl-G` | `Shift-Cmd-G` |
| `replace` | <span style="color: #000000">Opens the </span>*<span style="color: #000000">Replace</span>*<span style="color: #000000"> window. </span> | `Shift-Ctrl-F` | `Cmd-Alt-F` |
| `replaceAll` | <span style="color: #000000">Opens the </span>*<span style="color: #000000">Replace all</span>*<span style="color: #000000"> window</span> | `Shift-Ctrl-R` | `Shift-Cmd-Alt-F` |
| `selectAll` | <span style="color: #000000">Select the whole content of the editor</span> | `Ctrl-A` | `Cmd-A` |
| `singleSelection` | <span style="color: #000000">When multiple selections are present, this deselects all but the primary selection</span> | `Esc` | `Esc` |
| `killLine` | <span style="color: #000000">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.</span> |  | `Ctrl-K` |
| `deleteLine` | <span style="color: #000000">Deletes the whole line under the cursor, including newline at the end.</span> | `Ctrl-D` | `Cmd-D` |
| `delWrappedLineLeft` | <span style="color: #000000">Delete the part of the line from the left side of the visual line the cursor is on to the cursor.</span> |  | `Cmd-Backspace` |
| `delWrappedLineRight` | <span style="color: #000000">Delete the part of the line from the cursor to the right side of the visual line the cursor is on.</span> |  | `Cmd-Delete` |
| `undo` | <span style="color: #000000">Undo the last change</span> | `Ctrl-Z` | `Cmd-Z` |
| `redo` | Redo the last undone change | `Ctrl-Y` | `Shift-Cmd-Z` or `Cmd-Y` |
| `undoSelection` | <span style="color: #000000">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.</span> | `Ctrl-U` | `Cmd-U` |
| `redoSelection` | <span style="color: #000000">Redo the last change to the selection, or the last text change if no selection changes remain.</span> | `Alt-U` | `Shift-Cmd-U` |
| `goDocStart` | <span style="color: #000000">Move the cursor to the start of the document.</span> | `Ctrl-Home` | `Cmd-Up`<span style="color: #555555"> or</span><span style="color: #555555"> </span>`Cmd-Home` |
| `goDocEnd` | <span style="color: #000000">Move the cursor to the end of the document.</span> | `Ctrl-End` | `Cmd-End`<span style="color: #555555"> or</span><span style="color: #555555"> </span>`Cmd-Down` |
| `goLineStart` | <span style="color: #000000">Move the cursor to the start of the line.</span> | `Alt-Left` | `Ctrl-A` |
| `goLineStartSmart` | <span style="color: #000000">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).</span> | `Home` | `Home` |
| `goLineEnd` | <span style="color: #000000">Move the cursor to the end of the line.</span> | `Alt-Right` | `Ctrl-E` |
| `goLineRight` | <span style="color: #000000">Move the cursor to the right side of the visual line it is on.</span> |  | `Cmd-Right` |
| `goLineLeft` | <span style="color: #000000">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.</span> |  | `Cmd-Left` |
| `goLineUp` | <span style="color: #000000">Move the cursor up one line.</span> | `Up` | `Ctrl-P` |
| `goLineDown` | <span style="color: #000000">Move down one line.</span> | `Down` | `Ctrl-N` |
| `goPageUp` | <span style="color: #000000">Move the cursor up one screen and scroll up by the same distance.</span> | `PageUp` | `Shift-Ctrl-V` |
| `goPageDown` | <span style="color: #000000">Move the cursor down one screen and scroll down by the same distance.</span> | `PageDown` | `Ctrl-V` |
| `goCharLeft` | <span style="color: #000000">Move the cursor one character left, going to the previous line when hitting the start of the line.</span> | `Left` | `Ctrl-B` |
| `goCharRight` | <span style="color: #000000">Move the cursor one character right, going to the next line when hitting the end of the line.</span> | `Right` | `Ctrl-F` |
| `goWordLeft` | <span style="color: #000000">Move the cursor to the start of the previous word.</span> |  | `Alt-B` |
| `goWordRight` | <span style="color: #000000">Move the cursor to the end of the next word.</span> |  | `Alt-F` |
| `goGroupLeft` | <span style="color: #000000">Move to the left of the </span>[<span style="color: #000000">group</span>](#JQLexpressioneditorandtester-Group)<span style="color: #000000"> before the cursor. </span> | `Ctrl-Left` | `Alt-Left` |
| `goGroupRight` | <span style="color: #000000">Move to the right of the </span>[<span style="color: #000000">group</span>](#JQLexpressioneditorandtester-Group)<span style="color: #000000"> after the cursor</span><span style="color: #000000">.</span> | `Ctrl-Right` | `Alt-Right` |
| `delCharBefore` | <span style="color: #000000">Delete the character before the cursor.</span> | `Shift-Backspace` | `Ctrl-H` |
| `delCharAfter` | <span style="color: #000000">Delete the character after the cursor.</span> | `Delete` | `Ctrl-D` |
| `delWordBefore` | <span style="color: #000000">Delete up to the start of the word before the cursor.</span> |  | `Alt-Backspace` |
| `delWordAfter` | <span style="color: #000000">Delete up to the end of the word after the cursor.</span> |  | `Alt-D` |
| `delGroupBefore` | <span style="color: #000000">Delete to the left of the </span>[group](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461439080)<span style="color: #000000"> before the cursor.</span> | `Ctrl-Backspace` | `Alt-Backspace` |
| `delGroupAfter` | <span style="color: #000000">Delete to the start of the </span>[group](#JQLexpressioneditorandtester-Grou)<span style="color: #000000"> after the cursor.</span> | `Ctrl-Delete` | `Ctrl-Alt-Backspace or ``Alt-Delete` |
| `indentAuto` | <span style="color: #000000">Auto-indent the current line or selection.</span> | `Shift-Tab` | `Shift-Tab` |
| `indentMore` | <span style="color: #000000">Indent the current line or selection by one</span><span style="color: #000000"> indent unit.</span> | `Ctrl-]` | `Cmd-]` |
| `indentLess` | <span style="color: #000000">Dedent the current line or selection by one </span><span style="color: #000000">indent unit.</span> | `Ctrl-[` | `Cmd-[` |
| `defaultTab` | <span style="color: #000000">If something is selected, indent it by one</span><span style="color: #000000"> indent unit.</span><span style="color: #000000"> If nothing is selected, insert a tab character.</span> | `Tab` | `Tab` |
| `transposeChars` | <span style="color: #000000">Swap the characters before and after the cursor.</span> |  | `Ctrl-T ` |
| `newlineAndIndent` | <span style="color: #000000">Insert a newline and auto-indent the new line.</span> | `Enter` | `Enter` |
| `toggleOverwrite` | <span style="color: #000000">Flip the </span>overwrite<span style="color: #000000"> flag.</span> | `Insert` | `Insert` |

> ℹ️ ##### Group
> ℹ️ 
> ℹ️ <span style="color: #000000">A group is a stretch of word characters, a stretch of punctuation characters, a newline, or a stretch of </span>*<span style="color: #000000">more than one</span>*<span style="color: #000000"> whitespace character.</span>

### **JQL expression tester**

<span style="color: #000000">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.</span>

#### **Using the JQL expression tester**

<span style="color: #000000">After writing your JQL expression in the </span>[<span style="color: #000000">editor</span>](#JQLexpressioneditorandtester-JQLexpressioneditor)<span style="color: #000000">, click on the </span>`Test JQL search` button on the toolbar`.`` `<span style="color: #000000">A modal dialog window opens, asking you to pick an issue </span><span style="color: #000000">to run the JQL expression against. You can include </span>[<span style="color: #000000">Groovy template</span>](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461930609)<span style="color: #000000"> in your JQL expression. </span>

#### **Selecting an issue**

<span style="color: #000000">You can select the issue from one of the following options:</span>

- **<span style="color: #000000">Issue key:</span>**<span style="color: #000000"> start typing an </span>*<span style="color: #000000">issue key</span>*<span style="color: #000000">, you will be offered options based on your issue browsing history</span>
- **[Select issue]**<span style="color: #000000">: if you click on </span>`[Select Issue]`,<span style="color: #000000"> an Issue selector window gets displayed. You can select the issue either from:</span>
  - **<span style="color: #000000">Recent Issues</span>**<span style="color: #000000">: Displays issues that you have recently viewed and first 50 issues from your current search or</span>
  - **<span style="color: #000000">From Filter</span>**<span style="color: #000000">: Displays issues of your saved searches.</span>

<span style="color: #000000">The </span>[<span style="color: #000000">issue</span>](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461799437/Groovy+Variables+and+Functions#issue)<span style="color: #000000"> </span><span style="color: #000000">variable used in your </span>[<span style="color: #000000">Groovy template</span>](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461930609)<span style="color: #000000"> will point to this issue.</span>

#### <span style="color: #000000">Testing your JQL expression</span>

<span style="color: #000000">After selecting issue(s) against which the </span><span style="color: #000000">JQL expression </span><span style="color: #000000">should be tested (as explained above), click on </span>`Test. `<span style="color: #000000">The following information will be displayed. This information can be used for debugging.</span>

1. **<span style="color: #000000">Message</span>**<span style="color: #000000">: Success/error message based on the test result.</span>
2. **<span style="color: #000000">Actual JQL search:</span>**<span style="color: #000000"> The actual search</span>
3. <span style="color: #000000">**Issues returned by your search**</span><span style="color: #000000">: </span><span style="color: #000000">The result of the JQL query which is an array of issues.</span>

<span style="color: #000000">**Example**</span>

> ℹ️ *<span style="color: #000000">Test a JQL expression that fetches </span>**<span style="color: #000000">issues whose assignee and reporter are same</span>*
> ℹ️ 
> ℹ️ 1. <span style="color: #000000">Add the </span>[<span style="color: #000000">Set field value</span>](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461767530)<span style="color: #000000"> post-function to a transition. </span>
> ℹ️ 2. In the [JQL expression editor](#JQLexpressioneditorandtester-JQLexpressioneditor),<span style="color: #000000"> write the following lines of code:</span>
> ℹ️ 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:> Macro (inline-media-image)
> ℹ️ 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.
> ℹ️ 
> ℹ️ ![image](media://a8f2826b-67bc-4492-912f-ffa001569965)

#### <span style="color: #000000">Debugging your script</span>

<span style="color: #000000">If you encounter an error during testing, you will need to debug your script. The </span>[<span style="color: #000000">Message, Stack and Log</span>](#JQLexpressioneditorandtester-TestingyourJQLexpression)<span style="color: #000000"> information displayed in the JQL expression test</span><span style="color: #000000">er result panel aids in debugging the expression.</span>

##### <span style="color: #000000">**Using the Message and Stack trace**</span>

<span style="color: #000000">In the above example, </span><span style="color: #000000">after testing the script against an issue that is unassigned:</span>

- **<span style="color: #000000">Identify the problem,</span>**<span style="color: #000000"> from the </span>`Message`<span style="color: #000000"> that displayed a null pointer exception error and the </span>`Stack`<span style="color: #000000"> that displayed the line number on which the error occurred.</span>
- **<span style="color: #000000">Correct the problem,</span>**<span style="color: #000000"> using the safe navigation operator ? that avoids the null pointer exception.</span>
- **<span style="color: #000000">Retest the expression,</span>**<span style="color: #000000"> as </span>[<span style="color: #000000">explained above</span>](#JQLexpressioneditorandtester-TestingyourJQLexpression)<span style="color: #000000"> and verify the result in the expression test panel. T</span><span style="color: #000000">he result value will be null</span>  
> Macro (inline-media-image)