Template Values

Introduction

Template values allow you to dynamically populate templates with contextual data when being used.
The contextual data are mainly the issue for which a template is being used as well as the user using the template.
Template values therefore make it possible to create templates that are flexible, especially when adding logic via Template Functions.

How to access and use

You can simply access any value by wrapping it within {{ }}.
So if you wanted to show an issue’s summary you can do so by writing {{issue.summary}}.
When using a value as an argument in a Template Function, you must not wrap it. e.g. {{capitalize issue.summary}}.
When accessing a field that doesn’t exist it will return an empty string.

Fields

Simplified structure

The following shows the outline of the available fields. Please see the following sections for more details.

{ issue: { id: string, key: string, url: { // can be accesses directly to print browse url browseUrl: string, // prints the browse url customer: string, // prints the portal url if available smart: string // prints the portal url if available, otherwise it will fallback to the browse url } // ... the issue's fields } issues: Issue[], baseUrl: string, label: { <fieldname>: string }, currentUser: User, userTimezone: string, userLocale: string, now: ISO-Date, customData: { any } }

Issue

You have access to all fields/renderdFields values of an issue.
By default we prioritize populating a field with the renderedField’s value.
For some field types this might not always satisfy all your needs which is why we add Additional processing for those.

Here are some examples for often used fields:

issue.id the issue's technical id

issue.key the issue's key (e.g. "TEST-123")

issue.assignee the displayname of the assignee (e.g. "Jane Doe")

issue.duedate the duedate formatted in the user locale (e.g. "Jan 18, 2024, 3:00 PM")

 

Additionally we provide the following non-standard fields:

issue.url the browse url to this issue (e.g. "https://<your instance>.atlassian.net/browse/<issue key>")

issue.url.browseUrl direct access to the browse url to this issue (e.g. "https://<your instance>.atlassian.net/browse/<issue key>")

issue.url.customer the servicedesk url for issues in a JSM project (e.g. "https://<your instance>.atlassian.net/servicedesk/customer/portal/<issue key>")

issue.url.smart either the browse or servicedesk url depending on the issue's type

issue.comment comments have a different structure for easier access

issue.watchers array of users watching this issue

Assets

issue.customfield_xxxxx (e.g. customfield_10001) array of assets

issue.customfield_xxxxx.[n].label the label of the selected assets

issue.customfield_xxxxx.[n].attributes data of the asset

issue.customfield_xxxxx.[n].attributes.{attributeName} the value of one of the asset’s attributes

 

"issue": { "id": "10010", "key": "TEST-2", "lastViewed": { "rendered": "Nov 30, 2022, 12:01 PM", "raw": "2022-11-30T12:01:31.221+0100" }, "priority": { "self": "https://<your instance>.atlassian.net/rest/api/2/priority/3", "iconUrl": "https://<your instance>.atlassian.net/images/icons/priorities/medium.svg", "name": "Medium", "id": "3" }, "assignee": { "self": "https://<your instance>.atlassian.net/rest/api/2/user?accountId=a1b2c3d4e5f6g7h8i9j0k1l2", "accountId": "a1b2c3d4e5f6g7h8i9j0k1l2", "avatarUrls": { "48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png" }, "displayName": "Test User", "active": true, "timeZone": "Europe/Berlin", "accountType": "atlassian" }, "status": { "self": "https://<your instance>.atlassian.net/rest/api/2/status/10027", "description": "This issue is being actively worked on at the moment by the assignee.", "iconUrl": "https://<your instance>.atlassian.net/", "name": "In Progress", "id": "10027", "statusCategory": { "self": "https://<your instance>.atlassian.net/rest/api/2/statuscategory/4", "id": 4, "key": "indeterminate", "colorName": "yellow", "name": "In Progress" } }, "reporter": { "self": "https://<your instance>.atlassian.net/rest/api/2/user?accountId=a1b2c3d4e5f6g7h8i9j0k1l2", "accountId": "a1b2c3d4e5f6g7h8i9j0k1l2", "avatarUrls": { "48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png" }, "displayName": "Test User", "active": true, "timeZone": "Europe/Berlin", "accountType": "atlassian" }, "project": { "self": "https://<your instance>.atlassian.net/rest/api/2/project/10003", "id": "10003", "key": "TEST", "name": "Test", "projectTypeKey": "software", "simplified": true, "avatarUrls": { "48x48": "https://<your instance>.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10406", "24x24": "https://<your instance>.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10406?size=small", "16x16": "https://<your instance>.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10406?size=xsmall", "32x32": "https://<your instance>.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10406?size=medium" } }, "watches": { "self": "https://<your instance>.atlassian.net/rest/api/2/issue/TEST-2/watchers", "watchCount": 1, "isWatching": true }, "created": { "rendered": "Nov 23, 2022, 11:41 AM", "raw": "2022-11-23T11:41:00.004+0100" }, "customfield_10017": { "rendered": "purple" }, "updated": { "rendered": "23/Nov/22 11:44 AM", "raw": "2022-11-23T11:44:10.088+0100" }, "description": { "rendered": "\n\tUse handlebars-kit repo\n\tImplement datetime helpers\n\n" }, "summary": { "rendered": "Implement handlebars helpers" }, "customfield_10001": [ { "workspaceId": "2d6e93a7-a467-45e2-9229-65a9aa89c1d1", "id": "2d6e93a7-a467-45e2-9229-65a9aa89c1d1:2", "objectId": "2", "label": "Laptop", "objectKey": "IT-1", "avatar": { "url16": "https://<your instance>.atlassian.net/gateway/api/jsm/insight/workspace/2d6e93a7-a467-45e2-9229-65a9aa89c1d1/v1/objecttype/11/icon.png?size=16", "url48": "https://<your instance>.atlassian.net/gateway/api/jsm/insight/workspace/2d6e93a7-a467-45e2-9229-65a9aa89c1d1/v1/objecttype/11/icon.png?size=48", "url72": "https://<your instance>.atlassian.net/gateway/api/jsm/insight/workspace/2d6e93a7-a467-45e2-9229-65a9aa89c1d1/v1/objecttype/11/icon.png?size=72", "url144": "https://<your instance>.atlassian.net/gateway/api/jsm/insight/workspace/2d6e93a7-a467-45e2-9229-65a9aa89c1d1/v1/objecttype/11/icon.png?size=144", "url288": "https://<your instance>.atlassian.net/gateway/api/jsm/insight/workspace/2d6e93a7-a467-45e2-9229-65a9aa89c1d1/v1/objecttype/11/icon.png?size=288", "#defaultValue": "https://<your instance>.atlassian.net/gateway/api/jsm/insight/workspace/2d6e93a7-a467-45e2-9229-65a9aa89c1d1/v1/objecttype/11/icon.png?size=144" }, "objectType": { "workspaceId": "2d6e93a7-a467-45e2-9229-65a9aa89c1d1", "objectTypeId": "11", "id": "2d6e93a7-a467-45e2-9229-65a9aa89c1d1:11", "name": "Laptops", "icon": { "id": "62", "name": "Laptop", "url16": "https://<your instance>.atlassian.net/gateway/api/jsm/insight/workspace/2d6e93a7-a467-45e2-9229-65a9aa89c1d1/v1/objecttype/11/icon.png?size=16", "url48": "https://<your instance>.atlassian.net/gateway/api/jsm/insight/workspace/2d6e93a7-a467-45e2-9229-65a9aa89c1d1/v1/objecttype/11/icon.png?size=48" }, "objectSchemaId": "3" }, "attributes": { "Name": "Customer Laptop", "Serial Number": "1234567890" }, "links": { "self": "https://<your instance>.atlassian.net/gateway/api/jsm/insight/workspace/2d6e93a7-a467-45e2-9229-65a9aa89c1d1/v1/object/2" } } ], "customfield_10002": null, "customfield_10003": null, "comments": [{ "self": "https://<your instance>.atlassian.net/rest/api/2/issue/10010/comment/10063", "id": "10063", "author": { "self": "https://<your instance>.atlassian.net/rest/api/2/user?accountId=a1b2c3d4e5f6g7h8i9j0k1l2", "accountId": "a1b2c3d4e5f6g7h8i9j0k1l2", "avatarUrls": { "48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png" }, "displayName": "Test User", "active": true, "timeZone": "Europe/Berlin", "accountType": "atlassian" }, "body": { "rendered": "Also add possibility to set own variables." }, "updateAuthor": { "self": "https://<your instance>.atlassian.net/rest/api/2/user?accountId=a1b2c3d4e5f6g7h8i9j0k1l2", "accountId": "a1b2c3d4e5f6g7h8i9j0k1l2", "avatarUrls": { "48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png" }, "displayName": "Test User", "active": true, "timeZone": "Europe/Berlin", "accountType": "atlassian" }, "created": { "rendered": "Nov 23, 2022, 11:42 AM", "raw": "2022-11-23T11:42:38.166+0100" }, "updated": { "rendered": "Nov 23, 2022, 11:42 AM", "raw": "2022-11-23T11:42:38.166+0100" }, "jsdPublic": true } ], "url": { "browseUrl": "https://<your instance>.atlassian.net/browse/TEST-2", "customer": "https://<your instance>.atlassian.net/servicedesk/customer/portal/<issue key>", "smart": "https://<your instance>.atlassian.net/servicedesk/customer/portal/<issue key>" }, "watchers": [{ "self": "https://<your instance>.atlassian.net/rest/api/2/user?accountId=a1b2c3d4e5f6g7h8i9j0k1l2", "accountId": "a1b2c3d4e5f6g7h8i9j0k1l2", "avatarUrls": { "48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png" }, "displayName": "Test User", "active": true, "timeZone": "Europe/Berlin", "accountType": "atlassian" } ] }

 

You can access all custom fields.
We are working on an UI to show available data live and specific to your issues.
In the meantime, if you are looking for information how an field looks like, you can use the following Jira API: (make sure to replace Issue key and instance url )
https://<your instance>.atlassian.net/rest/api/2/issue/<issue key>?fields=*all&expand=renderedFields

Issues

issues

In automation this may be populated by passing issueIds via custom data. See the Custom data example below.
Outside of automation this will remain unused.

Current user

currentUser The current Atlassian Jira user. In automation context the actor of an action.

 

"currentUser": { "self": "https://<your instance>.atlassian.net/rest/api/3/user?accountId=a1b2c3d4e5f6g7h8i9j0k1l2", "accountId": "a1b2c3d4e5f6g7h8i9j0k1l2", "accountType": "atlassian", "avatarUrls": { "48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png", "32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/TU-5.png" }, "displayName": "Test User", "active": true, "timeZone": "Europe/Berlin", "locale": "en-GB", "groups": { "size": 1, "items": [] }, "applicationRoles": { "size": 3, "items": [] }, "expand": "groups,applicationRoles", "emailAddress": "contact@yasoon.com" }

Label

label key-value list of all fields to access a field's name in the users current locale.
Using this ensures your template adjust to the correct naming if you change a label in Jira.
It also takes different, context-sensitive configurations into account (e.g. the duedate could be renamed to Escalation Date for a specific project)

 

Custom data

customData Only present when used in automation. 1:1 representation of what has been configured to be passed on as custom data to an action.
Always empty when used outside automation.

Content of the “custom data” field in an automation action.

Will result in the following representation to be used in templates.

Other values

baseUrl e.g. "https://<your instance>.atlassian.net"

userTimezone Time zone to be used for dates. If present, it will contain a currentUser's time zone based on their Atlassian settings - else it defaults to "Europe/Berlin".

userLocale Locale to be used for dates. If present, it will contain a currentUser's locale based on their Atlassian settings - else it defaults to "en-US".

now A full ISO-Date of the current date and time. It will be converted automatically to the time zone in timezone (e.g. "2022-11-15T14:15:42.000+01:00").

Additional processing

For all fields that contain one or multiple users you can simply write issue.myUserField instead of issue.myUserField.displayName to print out the user’s name.

This also applies for any option field, for which it will print out the value.

We enrich string and date(time) with additional properties.
This is necessary as Atlassian renders these fields to contain a readable value which may make them unusable in Template Functions.

For date(time) fields we add

  • isoString containing the ISO-Date

  • rendered containing the formatted date in the user locale (e.g. Jan 18, 2024, 3:00 PM)

When simply accessing the date(time) field it will print the rendered value.

For string fields we add

  • rendered containing the field's value

When simply accessing the string field it will print the rendered value.

Be aware that when using such a field in Template Functions, it will still access the entire object, even if it prints a specific value.

Full Example representation