Dynamic Templates

Use templates in the JQL query, the description and the display condition of a configuration: they adapt to issue data, user context, and linked issues. Templates run in a sandbox and cannot run JavaScript.

Basic Syntax

Variables

Output data with double curly braces:

{{ issue.key }}
{{ issue.fields.summary }}
{{ issue.fields.status.name }}

Conditions

{% if condition %}
  Content when true
{% elif otherCondition %}
  Content when other is true
{% else %}
  Content otherwise
{% endif %}

Loops

{% for item in array %}
  {{ item }}
{% empty %}
  Nothing found
{% endfor %}

Available Variables

Issue Data

Variable Description
{{ issue.key }} Issue key (PROJ-123)
{{ issue.id }} Issue ID
{{ issue.fields.summary }} Summary
{{ issue.fields.description }} Description - raw ADF document dump, not readable text
{{ issue.fields.status.name }} Status name
{{ issue.fields.priority.name }} Priority name
{{ issue.fields.assignee.displayName }} Assignee name
{{ issue.fields.reporter.displayName }} Reporter name
{{ issue.fields.created }} Created date
{{ issue.fields.updated }} Updated date
{{ issue.fields.duedate }} Due date
{{ issue.fields.project.name }} Project name
{{ issue.fields.project.key }} Project key
{{ issue.fields.issuetype.name }} Issue type

Shortcuts:

  • {{ key }} → {{ issue.key }}
  • {{ fields.summary }} → {{ issue.fields.summary }}
  • {{ project.key }} → {{ issue.fields.project.key }}
  • {{ priority.name }} → {{ issue.fields.priority.name }}
  • {{ status.name }} → {{ issue.fields.status.name }}

Custom fields:

{{ issue.fields.customfield_10001 }}

Custom fields are addressed by their field ID only (customfield_XXXXX). There is no access by field name - {{ issue.fields["My Custom Field"] }} resolves to nothing. Open the Show issue JSON tab of the configuration editor and click Download Issue Data to look up the ID of a field.

Current User

Variable Description
{{ currentUser.accountId }} Account ID
{{ currentUser.displayName }} Display name
{{ currentUser.timeZone }} Time zone - always UTC
{{ currentUser.locale }} Locale (e.g. en-US)

{{ user }} is an alias for {{ currentUser }}.

Email is not available. {{ currentUser.emailAddress }} does not resolve anywhere - the app does not request the email scope, so the address is never part of the template context. The same applies to emailAddress on issue users such as reporter or assignee.

Only accountId is guaranteed. When a panel is rendered or while evaluating a display condition, currentUser carries the accountId and nothing else. Build conditions on currentUser.accountId; do not rely on displayName, timeZone or locale in those contexts.

Linked Issues

When using Linked Issues or JQL data source:

{{ linkedIssues.length }} - Count

{% for linked in linkedIssues %}
  {{ linked.key }}: {{ linked.fields.summary }}
{% endfor %}

Conditions

Comparison Operators

==   Equal to
!=   Not equal to
>    Greater than
<    Less than
>=   Greater or equal
<=   Less or equal

Logical Operators

and   Logical AND
or    Logical OR
not   Logical NOT

Membership

{% if "High" in ["High", "Highest"] %}
  High priority
{% endif %}

Examples

Check status:

{% if issue.fields.status.name == "Done" %}
  Completed
{% endif %}

Check assignee:

{% if issue.fields.assignee %}
  Assigned to: {{ issue.fields.assignee.displayName }}
{% else %}
  Unassigned
{% endif %}

Check current user:

{% if issue.fields.assignee.accountId == currentUser.accountId %}
  This issue is assigned to you!
{% endif %}

Combined conditions:

{% if issue.fields.priority.name == "High" and issue.fields.status.name != "Done" %}
  High priority issue needs attention
{% endif %}

Loops

Basic Loop

{% for label in issue.fields.labels %}
  - {{ label }}
{% endfor %}

With Empty Block

{% for issue in linkedIssues %}
  {{ issue.key }}
{% empty %}
  No linked issues
{% endfor %}

Loop Variables

Variable Description
loop.index 0-based index
loop.index1 1-based index
loop.number Alias for index1
loop.first True for first item
loop.last True for last item
loop.even True for even iterations (0, 2, 4…)
loop.odd True for odd iterations (1, 3, 5…)
loop.length Total number of items

Example:

{% for link in linkedIssues %}
  {{ loop.index1 }}. {{ link.key }}{% if not loop.last %}, {% endif %}
{% endfor %}

Loop Control

{% break %}      Exit loop
{% continue %}   Skip to next

Common Filters

Transform values using | (pipe):

Filter Description Example
default(value) Fallback for null {{ name | default("Unknown") }}
len Get length {{ items | len }}
date(format) Format date {{ created | date("yyyy-MM-dd") }}
fromNow Relative time {{ updated | fromNow }}
upper Uppercase {{ text | upper }}
lower Lowercase {{ text | lower }}
truncate(n) Truncate to n chars {{ text | truncate(50) }}
join(sep) Join array {{ labels | join(", ") }}
first First element {{ items | first }}
last Last element {{ items | last }}
take(n) Take first n items {{ items | take(5) }}
filter(path, op, val) Filter array {{ issues | filter("status", "==", "Done") }}
issueLink Issue key as text (not a URL) {{ linked.key | issueLink }}

See Template Filters for the complete list.


Next Steps