---
title: "Groovy editor in JMWE"
canonical: "https://support.appfire.com/space/JMWE/461897846/Groovy%20editor%20in%20JMWE"
format: markdown
---
> Macro (aura-html)

### **Groovy editor features**

Groovy editor in JMWE is where you should be writing your Groovy scripts. This editor has the

- Basic features like automatically indenting the code, checking for syntax errors in the code, colorizing keywords, comments, variables and so on and
- Advanced features, such as Find and Replace, that are available through keyboard shortcuts.

#### Groovy Help in the Groovy editor

The editor also has a Groovy help section that assists you in writing your Groovy scripts with ease. It has the following tabs:

**Expected Value:** This tab lists the possible expected values for the selected `Field` and `Value Type`. This is applicable in contexts where you set a field value or comment an issue or write a conditional Groovy script. Select the `Field` and `Value Type`. Click on` ``Expected Value.` The help editor displays the expected values for the selected field based on the value type. E<span style="color: #091e42">xpected values of all the fields are listed</span><span style="color: #091e42"> </span>[<span style="color: #091e42">here</span>](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78055772)<span style="color: #091e42">.</span>

**Templates:**** **This tab lists a few important Groovy markups that you might want to use to create your Groovy templates. This is applicable in contexts where you set a field value, comment an issue, write content (in the Email issue post-function) or a JQL search expression using Groovy templates. Hover over any button to get the information, click on it to insert it into the editor. For more information, click [here](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78058927).

**Globals:**** **This tab lists the Global variables and functions that are available for your Groovy expressions and templates. Hover over any button to get the information, click on it to insert it into the editor. For more information, click [here](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78055921).

**Issue Fields: **This tab lists the fields of the current issue, original issue, linked issue or the parent issue depending on the context. Select a field and an issue variable. The help editor displays a few Groovy expressions accessing the field values, sub-fields etc by the field name. You can refer to the issue either by the `field name` or the `field ID`.  Groovy expressions to access all the fields of an issue are<span style="color: #091e42"> listed</span><span style="color: #091e42"> </span>[<span style="color: #091e42">here</span>](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78055905)<span style="color: #091e42">.</span>

**Issue Methods: **This tab lists the methods applicable to the current issue, original issue, linked issue or the parent issue depending on the selected issue variable. Hover over any button to get the information, click on it to insert it into the editor. For more information, click [here](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78055970).

**Interfaces: **This tab can describe any Jira, Groovy or Java interface or class. Select an interface and the editor displays the properties and methods of the selected interface. Hover over any button to get the information, click on it to insert it into the editor. For more information, click [here](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78056917).

**More help: **This menu gives you access to additional help pages.

> ⚠️ <span style="color: #000000">Ensure the Groovy script or template inserted into the editor matches the Groovy input type</span>** **<span style="color: #000000">selected in the post-function (wherever applicable). If not, a warning message is displayed notifying you to modify the input type.</span>

#### Groovy Help in the Groovy editor

Suppose you want the issue to get assigned to the Project Lead if left unassigned.

- Add the *Set field value** *post-function to the transition of the issue workflow.
- Select the `Assignee` field.
- Select `Groovy expression` in the `Value type`.
- Click on `Issue Fields` tab of the help editor.
- Select `Project` under` ``Select a field`.
- Under the `Accessing sub-fields` section locate the Groovy expression to access the Project Lead.
- Click on it to insert it into the editor.
- Go to the `Conditional Execution section` of the post-function and activate it.
- Click on `Issue Fields` of the help editor.
- Select `Assignee` under `Select a field`.
- Under the `Testing the field's value` section locate the Groovy expression to test whether the Assignee field is empty.
- Click on it to insert it into the editor.

#### **Groovy editor availability**

- The Groovy script editor in JMWE is available on the:
  - Post-function configuration screen when you select:
    - `Groovy expression/Groovy Template` as *Value type* in the post-functions that set a field value
    - `Groovy expression``/Groovy Template `as *Comment type* in the post-functions that comment an issue
    - the [Conditional execution](https://appfire.atlassian.net/wiki/display/JMWE/Conditional+execution+using+Groovy+expression) option in any post-function
  - Post-function configuration screen of the [Create/Clone issue(s)](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461472239) post-function when you select:
    - `Calculated` as *Project*
    - `Calculated` as *Parent issue*
    - `Set field value from Groovy` or `Set field value from Groovy template` while setting a field in *Set fields of new issue*
    - `Groovy expression``/Groovy Template `as *Comment type* while adding a comment to the current issue
  - Post-function configuration screen of the [Email issue](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461767713) post-function while writing the Email content and recipients
  - Post-function configuration screen of the [Link issues to the current issue](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461538264) post-function while writing the JQL search expression
  - Post-function configuration screen of the [Unlink issues from the current issue](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461538190) post-function
  - Configuration screens of the [Scripted (Groovy) condition](https://appfire.atlassian.net/wiki/display/JMWE/Scripted+%28Groovy%29+condition), [Scripted (Groovy) validator](https://appfire.atlassian.net/wiki/display/JMWE/Scripted+%28Groovy%29+validator) and [Scripted (Groovy) operation on issue](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461702143) post-function
  - [Groovy console](https://appfire.atlassian.net/wiki/x/-QGnB) admin screen that allows you to test/run Groovy scripts

#### **Groovy editor toolbar**

The Groovy 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:** <span style="color: #000000">Finds 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 Groovy Script:** Opens the Test Groovy script window to input the Issue key. Use it to [test your script](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461766715/Groovy+script+tester+in+JMWE#GroovyscripttesterinJMWE-TestingyourGroovyscript).
- **Test again:** [Retests your script](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461766715/Groovy+script+tester+in+JMWE#GroovyscripttesterinJMWE-TestingyourGroovyscript)

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

#### **Groovy 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>](#GroovyeditorinJMWE-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>](#GroovyeditorinJMWE-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/461897846)<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](#GroovyeditorinJMWE-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>