Our new Appfire Documentation Space is now live!
Take a look here! If you have any questions please email support@appfire.com
How to insert information using Nunjucks annotations
Introduction to Nunjucks
Nunjucks is a sophisticated templating engine for JavaScript. It lets you insert dynamic content in any text through the use of templates. A template contains variables and/or expressions, which get replaced with values when a template is rendered; and tags, which control the logic of the template. See here for an overview of the templating features available in Nunjucks.
On this page:
Nunjucks in JMWE for JIRA Cloud
Nunjucks in JMWE for Jira Cloud is used to insert information in
- Set issue fields and Set field value of linked issues post-function to set a field value
- Comment issue(s) and Comment linked issues to create the body of the comment
- Conditional execution section to conditionally execute a post-function
- Transition [Current/Linked/Parent] issue(s) for specifying the transition to be triggered
- Create/Clone issue post-function to
- Calculate a project by selecting
Calculated
inProject
- Calculate a parent issue key by selecting
Another issue
inParent issue
- Set fields of new issue by selecting
Set field value to
- Add a comment to the current issue
- Calculate a project by selecting
- Email issue post-function to
- Write the
Subject, HTML body, Text body
- Set the
Recipients
from the script inUsers from template
andGroups from template
- Write the
- Unlink issues from the current issue post-function to unlink issues based on the result of a Nunjucks template
- Admin screen to test/run Nunjucks templates
- Link issues to the current issue post-function to write
JQL search expression
You can insert issue and transition information into the value using the templating features available in Nunjucks. Some basic templating features are described in this document, and more are documented on the Nunjucks website.
Templating features in Nunjucks
- Nunjucks template editor and tester
- Variables used in Nunjucks templates — A variable looks up a value from the template context. This documents details on the variables available in JMWE and how to create custom variables.
- Built in Nunjucks Filters — Filters are essentially functions that can be applied to variables. This document details some of the Nunjucks built-in filters.
- Custom Nunjucks filters — Filters are essentially functions that can be applied to variables. Filters are called with a pipe operator (|) and can take arguments. This document details custom Nunjucks filters created for JMWE.
- Tags and Expressions — Tags are special blocks that perform operations on sections of the template and Expressions are literal expressions similar to those in javascript.
- Accessing the details of an issue or a transition in Nunjucks — This document explains how to access the details of issue and transition objects, such as those available through the issue and transition variables. To see an example of the structure of an issue go to <base_URL_of_Jira>/rest/api/latest/issue/{issueKey}. The fields displayed through this REST API actually depend on the fields set on the issue.
- Conditional execution — Post functions are provided with an option to control their execution. You need to input a Nunjucks template in the Condition field, and based on the result of that expression, the post-function will either be executed or skipped.
- Shared Nunjucks Templates
You might also want to look at Accessing the details of an issue or a transition in Nunjucks to know how to access the details of an issue or a transition.
See here for more templating features available in Nunjucks. You might also want to see here for use cases with Nunjucks annotations.