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

#### **Groovy editor features**

Groovy editor in JMCF 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 calculated custom field being configured. Click on `Expected Value `tab of the Groovy help editor to see the expected values for the calculated field. 

**Globals:**** **This tab lists the Global variables and functions that are available for your Groovy expressions. 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/JMCF/pages/465732169).

**Issue Fields: **This tab lists the fields of the current issue, linked issue or the parent issue depending on the context. Select a field. 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/JMCF/pages/465371580)<span style="color: #091e42">.</span>

**Issue Methods: **This tab lists the methods applicable to the current issue, linked issue or the parent issue depending on the context. 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/JMCF/pages/465764748).

**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. <span style="color: #000000">Methods/properties in </span><span style="color: #339966">green</span><span style="color: #339966"> </span><span style="color: #000000">are provided by the add-on, and those in </span><span style="color: #000000">blue</span><span style="color: #000000"> by the Groovy language. For more information, click </span>[<span style="color: #000000">here</span>](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465863009)<span style="color: #000000">.</span>

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

#### Using Groovy Help in the Groovy editor

Suppose you want the calculate and display the Project name <span style="color: #333333">of the issue's project</span>

- Create a Calculated Text custom field type:` ``Project Category`, from the Custom fields administration page.
- Locate the custom field <span style="color: #333333">on the Custom Fields administration page.</span>
- Click on the cog wheel and click on `Configure`
- Click on `Edit Groovy Formula`
- 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 name.
- Click on it to insert it into the editor.

#### **Groovy editor availability**

The Groovy script editor in JMCF is available on the Custom field configuration screens of calculated custom field types that expect the result of a `Groovy script.`

#### **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/JMCF/pages/465764674).
- **Test again:** [Retests your script](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465764674)

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>](#GroovyeditorinJMCF-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>](#GroovyeditorinJMCF-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/JMCF/pages/465600948)<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](#GroovyeditorinJMCF-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>