Our new Appfire Documentation Space is now live!
Take a look here! If you have any questions please email support@appfire.com
Jira expressions editor and tester
JMWE for Jira Cloud provides a Jira expressions editor and tester in the conditions and validators configuration screens. This document details their availability and features.
Jira expressions editor and tester availability
The Jira expressions editor and tester is available on the:
Nunjucks and Jira expressions tester on the JMWE Administration section - This page allows you to test Jira expressions against issues without needing to edit a workflow transition.
- To access the tester, from the JIRA MISC WORKFLOW EXTENSIONS admin left panel, select Nunjucks and Jira expressions tester, then select Jira expression as the Type.
- To access the tester, from the JIRA MISC WORKFLOW EXTENSIONS admin left panel, select Nunjucks and Jira expressions tester, then select Jira expression as the Type.
- Linked Issues Condition and Linked Issues Validator to input a Jira expression to check on each linked issue
- Scripted (Jira expression) Condition and Scripted (Jira expression) Validator to input a Jira expression to be evaluated
- Validator scope section of Linked Issues Validator and Linked Issues Status Validator to control the execution of the validator
On this page:
Jira expressions editor
Jira expressions editor features
The Jira expressions editor in JMWE Cloud is available for all input fields that support Jira expressions. This editor has the:
- Basic features like automatically colorizing keywords, comments, variables and so on and
- Advanced features, such as Find and Replace, that are available through keyboard shortcuts.
Help in the Jira expressions editor
The editor also has a help section that assists you in writing your Jira expressions with ease. It has the following tabs:
Expected Value: This tab lists the possible expected values for the selected Field
. This is applicable in contexts where you insert field information in the condition. Select the Field
. Click on Expected Value.
The help editor displays the expected values for the condition.
Jira expression: This tab has a brief introduction to Jira expressions and links to the official documentation.
Globals: This tab lists the Global variables that are available for your Jira expressions. Hover over any button to get the information, click on it to insert it into the editor. For more information, click here.
Issue Fields: This tab lists the value of almost any field of an issue in a Jira expression. To find out how to access a field, select the field and the help editor displays a few Nunjucsk expressions accessing the field values, sub-fields etc by the field id. Jira expressions access all the fields of an issue are listed here.
Data types: This tab lists the properties of a data type returned by the tested script or the data type selected.
More help: This menu gives you access to additional help pages.
Using help in the editor
Suppose you want to write a condition in the to check that the issue is assigned
- Click on
Issue Fields
of the help editor. - Select
Assignee
underSelect a field
. - Under the
Testing the field's value
section locate the Jira expression to test whether the Assignee field is empty. - Click on it to insert it into the editor.
Jira 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 |
---|---|---|---|
find | Opens the search box. Use /re/ syntax for regexp search | Ctrl-F | Cmd-F |
findNext | Post a search, finds the next occurrence of the search | Ctrl-G | Cmd-G |
findPrev | Post a search, finds the previous occurrence of the search | Shift-Ctrl-G | Shift-Cmd-G |
replace | Opens the Replace window. | Shift-Ctrl-F | Cmd-Alt-F |
replaceAll | Opens the Replace all window | Shift-Ctrl-R | Shift-Cmd-Alt-F |
selectAll | Select the whole content of the editor | Ctrl-A | Cmd-A |
singleSelection | When multiple selections are present, this deselects all but the primary selection | Esc | Esc |
killLine | 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. | Ctrl-K | |
deleteLine | Deletes the whole line under the cursor, including newline at the end. | Ctrl-D | Cmd-D |
delWrappedLineLeft | Delete the part of the line from the left side of the visual line the cursor is on to the cursor. | Cmd-Backspace | |
delWrappedLineRight | Delete the part of the line from the cursor to the right side of the visual line the cursor is on. | Cmd-Delete | |
undo | Undo the last change | Ctrl-Z | Cmd-Z |
redo | Redo the last undone change | Ctrl-Y | Shift-Cmd-Z or Cmd-Y |
undoSelection | 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. | Ctrl-U | Cmd-U |
redoSelection | Redo the last change to the selection, or the last text change if no selection changes remain. | Alt-U | Shift-Cmd-U |
goDocStart | Move the cursor to the start of the document. | Ctrl-Home | Cmd-Up or Cmd-Home |
goDocEnd | Move the cursor to the end of the document. | Ctrl-End | Cmd-End or Cmd-Down |
goLineStart | Move the cursor to the start of the line. | Alt-Left | Ctrl-A |
goLineStartSmart | 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). | Home | Home |
goLineEnd | Move the cursor to the end of the line. | Alt-Right | Ctrl-E |
goLineRight | Move the cursor to the right side of the visual line it is on. | Cmd-Right | |
goLineLeft | 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. | Cmd-Left | |
goLineUp | Move the cursor up one line. | Up | Ctrl-P |
goLineDown | Move down one line. | Down | Ctrl-N |
goPageUp | Move the cursor up one screen and scroll up by the same distance. | PageUp | Shift-Ctrl-V |
goPageDown | Move the cursor down one screen and scroll down by the same distance. | PageDown | Ctrl-V |
goCharLeft | Move the cursor one character left, going to the previous line when hitting the start of the line. | Left | Ctrl-B |
goCharRight | Move the cursor one character right, going to the next line when hitting the end of the line. | Right | Ctrl-F |
goWordLeft | Move the cursor to the start of the previous word. | Alt-B | |
goWordRight | Move the cursor to the end of the next word. | Alt-F | |
goGroupLeft | Move to the left of the group before the cursor. | Ctrl-Left | Alt-Left |
goGroupRight | Move to the right of the group after the cursor. | Ctrl-Right | Alt-Right |
delCharBefore | Delete the character before the cursor. | Shift-Backspace | Ctrl-H |
delCharAfter | Delete the character after the cursor. | Delete | Ctrl-D |
delWordBefore | Delete up to the start of the word before the cursor. | Alt-Backspace | |
delWordAfter | Delete up to the end of the word after the cursor. | Alt-D | |
delGroupBefore | Delete to the left of the group before the cursor. | Ctrl-Backspace | Alt-Backspace |
delGroupAfter | Delete to the start of the group after the cursor. | Ctrl-Delete | Ctrl-Alt-Backspace or Alt-Delete |
indentAuto | Auto-indent the current line or selection. | Shift-Tab | Shift-Tab |
indentMore | Indent the current line or selection by one indent unit. | Ctrl-] | Cmd-] |
indentLess | Dedent the current line or selection by one indent unit. | Ctrl-[ | Cmd-[ |
defaultTab | If something is selected, indent it by one indent unit. If nothing is selected, insert a tab character. | Tab | Tab |
transposeChars | Swap the characters before and after the cursor. | Ctrl-T | |
newlineAndIndent | Insert a newline and auto-indent the new line. | Enter | Enter |
toggleOverwrite | Flip the overwrite flag. | Insert | Insert |
Group
A group is a stretch of word characters, a stretch of punctuation characters, a newline, or a stretch of more than one whitespace character.
Lookup user
Atlassian has removed personal data from the API that is used to identify users, such as username
and userKey
, and instead, using the Atlassian account ID (accountId
). Hence you would need to write conditions that use the accountId instead of the userkey
or username
in the scripts. However, the accountId
is not obvious in Jira. You can use this Lookup user feature in the Jira expressions editor to find the accountId
of a user. To insert the accountId
of a user:
- Click on the Lookup user button
- Select the user from
Search for user
- Click on Insert accountId
Jira expressions tester
The Jira expressions tester tool lets you test your expression against any issue. The main advantage of this tool is that you can quickly test and debug your script without having to actually trigger the transition (for validators) or look for transition availability on the issue (for conditions).
Using the Jira expressions tester
After writing your Jira expressions script in the editor, click on Test Jira expression.
A window opens, asking you to input an issue to run the Jira expressions script against. The issue
variable used in your script will point to this issue.
The transition
variable will not reflect transition information during testing.
Testing your Jira expression
After selecting the issue against which the script 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.
- Result value: Value of the result.
Example
Test that the issue is assigned to a specific user
In the Jira expression field, write the following lines of code:
issue.assignee.accountId == "156165:3a41d4ee-3331-4363-8cdf-f90a2da92f7e:"
- Click on
Test Jira expression
- Type the
Issue key
of an issue assigned to the user with the specifiedaccountId
. - Click on
Test.
- The following result is displayed:
Debugging your Jira expression script
If you encounter an error during testing or your script doesn't seem to work as expected, you will need to debug your script. The information displayed in the Jira expression tester result panel aids in debugging the script.
Consider the following script which tests that the current issue has a Fix Version/s. Write it in the Jira expressions editor.
issue.fixVersions and issue.fixVersions.length > 0
- Test the script, as explained above against an issue that has Fix Version/s. The following result is displayed.
- Identify the problem, from the
Message
displayed Correct the problem, by modifying the script
issue.fixVersions && issue.fixVersions.length > 0
- Retest the script, by clicking on
Test again
and verify the result in the script test panel.