Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Section


Column

Starting with version 1.0.9-AC, JMWE for Jira Cloud provides a Nunjucks template editor and tester in the post-function configuration screens. This document details their availability and features.

Nunjucks editor and tester availability

The Nunjucks template editor and tester are available on the:

  • Nunjucks tester on the JMWE Administration section - This page allows you to test Nunjucks expressions against Jira issues without needing to edit a workflow transition.
  • Post-function configuration screen of post-functions that:
    • Set a field value
    • Comment an issue
  • Post-function configuration of the Create issue post-function when you 
    • Select a destination project using the Calculated option
    • Specify the parent issue using the Another issue option
    • Set a field of the new issue using the Set field value to option
    • Add a comment to the current issue
  • Post-function configuration screen of Transition [current/linked/parent] issue post-functions when you:
    • Set value of fields on the Transition screen
    • Add a comment during the transition
  • Post-function configuration screen of Email issue post-function to write the Subject, HTML body, Text body and set the Recipients from the script in Users from template and Groups from template
  • Post-function configuration of Link issues to the current issue post-function to to write JQL search expression
  • Post-function configuration of Unlink issues from the current issue post-function to unlink issues based on the result of a Nunjucks template
  • Post-function configuration screen of any post-function when you select the Conditional execution option


Column
width50%


Panel
borderColorsilver
bgColor#f5f5f5
borderWidth1
borderStylesolid

On this page:

Table of Contents
maxLevel4



...

Expected Value: This tab lists the possible expected values for the selected Field. This is applicable in contexts where you set a field value or comment an issue or write a conditional Nunjucks template. Select the Field. Click on Expected Value. The help editor displays the expected values for the selected field. Expected values of all the fields are listed here.

Nunjucks Basics: This tab has a brief introduction to Nunjucks. For detailed information click on the respective tabs (listed below).

Block and Tags: This tab lists a few important blocks and tags that you might want to use to create your Nunjucks templates. Hover over any button to get more information, click on it to insert it into the editor. For more information, click here.

Globals: This tab lists the Global variables that are available for your Nunjucks templates. 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 fields of the current issue, linked issue or the parent issue depending on the context. Select a field and an issue variable. The help editor displays a few Nunjucks templates 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.  Nunjucks templates to access all the fields of an issue are listed here.

Filters: This tab lists the built-in and custom Nunjucks filters that can be applied to the variables in your Nunjucks templates. Hover over any button to get the information, click on it to insert it into the editor. For more information, click here.

...

CommandDescriptionPCMac
find

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

Ctrl-FCmd-F
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
replace

Opens the Replace window.

Shift-Ctrl-FCmd-Alt-F
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.
Ctrl-K
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.
Cmd-Backspace
delWrappedLineRightDelete the part of the line from the cursor to the right side of the visual line the cursor is on.
Cmd-Delete
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 orCmd-Home
goDocEndMove the cursor to the end of the document.Ctrl-EndCmd-End orCmd-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.
Cmd-Right
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.
Cmd-Left
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.
Alt-B
goWordRightMove the cursor to the end of the next word.
Alt-F
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.
Alt-Backspace
delWordAfterDelete up to the end of the word after the cursor.
Alt-D
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.
Ctrl-T 
newlineAndIndentInsert a newline and auto-indent the new line.EnterEnter
toggleOverwriteFlip the overwrite flag.InsertInsert

...

Panel

Test a template that fetches the username of the user the issue is assigned to:

  • Add the Set field value post-function to a transition.
  • In the Nunjucks editor, write the following lines of code:

    Code Block
    languagejs
    linenumberstrue
    {{ issue.fields.assignee.name accountId}}


  • Click on Test Nunjucks template
  • Type the Issue key of an issue assigned to a valid user.
  • Click on Test.
  • The following result is displayed:
    Image RemovedImage Added

Debugging your template

...