Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

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.

On this page:

You might want to look here for some more built-in tags and expressions in Nunjucks.



The set tag creates or modifies a variable.

For example:

{% set comments = issue.fields.comment.comments %} sets the comments variable with all the comment objects of the issue.


The setContextVar tag creates or modifies a context variable. Context variables are used to pass information between post-functions in a Sequence of post-functions, a Shared Action or a Scheduled Action. Context variables are available through the transition.context global variable. For example, if you create a context variable myVar in the first post-function of the sequence:

{% setContextVar myVar = "a value" %}

This variable will then be available to subsequent post-functions as:

{{ transition.context.myVar }}


The if tag tests a condition.

For example:

{% if issue.fields.issuetype.name == "Task"} This is a task {% endif %}

returns This is a task if and only if the issue type is "Task".


The for tag iterates over an array of values or objects. 

For example:

iterates over the comments variable and displays each comment body.


The include tag pulls in other templates in place. It's useful when you need to share smaller chunks across several templates. An included template does not participate in the block structure of its including template; it has a totally separate inheritance tree and block namespace. In other words, an include is not a pre-processor that pulls the included template code into the including template before rendering; instead, it fires off a separate render of the included template, and the results of that render are included.


where Test is the name of the shared Nunjucks template saved in the Admin page.


The import tag loads a template and allows you to access its exported values. Macros and top-level assignments are exported from templates, allowing you to access them in your current template.


where Test is the name of the shared Nunjucks template saved in the Admin page. sum is the name of the macro.

For example:

A Mapping macro to set the Priority based on the impact on the issue.

Shared Nunjucks template:

Name of the template : Mappings

Access the template in a post-function to set the Priority of the issue:

Whitespace control

The Nunjucks script outputs everything outside of variable and tag blocks verbatim, with all the whitespace (spaces, tabs, newlines,...) as it is in the script. For example, the following script:

will result in the following output:

If you don't want the extra whitespace between Nunjucks tags, then you can add the minus sign (-) to the start or end block to strip leading or trailing whitespace. For example:

will result in the following output:

See the Nunjucks documentation for more details.

We already automatically remove spaces and carriage returns surrounding template result values in most post-functions.


Mathematical expressions

Nunjucks allows you to do simple calculations on numbers.

For example:

{{ issue.fields.Field1 + issue.fields.Field2 }} outputs the sum of two custom field values, where Field1 and Field2 are the custom field names.

{{ OriginalEstimate*2 }} doubles the original estimate of the issue.


Nunjucks allows you to compare two values or objects.

For example:

{{ issue.fields.issuetype.name == "Task" }} compares both values.


Nunjucks allows you to use if as an inline expression.

For example:

{{ "true" if var else "false" }} outputs the string "true" if the variable var is defined, else it outputs "false".