The uploaded template file must be XHTML or Docx file. Template supports inline CSS and all markup attributes. The sample you may download here: html and docx.
You can use predefined variables as ${varname} in template. Following variables are supported:
- $issue - a current issue object com.atlassian.jira.issue.Issue
- $status - a status object of issue. Get the text of the status with: <p>$status.getSimpleStatus().getName()</p>
- $summary - a current issue summary
- $description - a current issue description
- $assignee - a current issue formatted assignee
- $reporter - a current issue formatted reporter
- $env - a current issue environment
- $created - a current issue formatted creation time
- $updated - a current issue formatted update time
- $due - a current issue formatted due date
- $nowDate - a current formatted date
- $nowTime - a current formatted timestamp
- $labels - a current issue collection of labels as array
- $fieldRenderer.renderField("<name>") - a current issue custom field value, where <name> is custom field name
- $fieldRenderer.renderField("<name>", "<default_value>") - a current issue custom field value, where <name> is custom field name. If value is NULL then <default_value> will render
- $fieldRenderer.renderFieldById("<id_num>") - a current issue custom field value, where <id> is custom field id (only numbers)
- $fieldRenderer.renderFieldById("<id_num>", "<default_value>") - a current issue custom field value, where <id> is custom field id (only numbers). If value is NULL then <default_value> will render
- $fieldRenderer.renderWiki2Html - wiki content from the current ticket custom field, available starting with v2.0.2
- $components - a current issue collection of project components as array
- $affectVersions - a current issue collection of affect versions as array
- $fixVersions - a current issue of fix versions as array
- $currentUser - a current logged user
- $linkCollection - the instance of com.atlassian.jira.issue.link.LinkCollection for current issue
- $stringUtils - the instance of org.apache.commons.lang.StringUtils.StringUtils
- $encoder - the instance of com.atlassian.jira.util.JiraUrlCodec
- $comments - the collection of objects com.atlassian.jira.issue.comments.Comment. You can loop through them using for instance
- $customField $customFields - an array of custom fields that you can access from the current task, available starting with version 2.0.4
$dateFormatter.withStyle("MM.dd.yyyy").format($issue.getCreated()) - formats dates and times into a given timezone in a variety of formats; available starting with version 2.0.5
- $locale - returns the system Locale, available starting with version 2.0.5
- $localeName - returns the Locale Name, available starting with version 2.0.5
- $systemLocale - returns the system Locale, available starting with version 2.0.5
- $systemLocaleName - returns the system Locale Name, available starting with version 2.0.5
- $timeZone - returns the time zone, available starting with version 2.0.4 and above)5
- $dateFormatHint - provides localized version of names of months, days, eras and meridiem, available starting with version 2.0.5
- $dateTimeFormatHint - returns a new formatter that will use the time zone and locale of the user that is logged in when format and/or parse are called, available starting with version 2.0.5
Example 1
#foreach($comment in $comments) <p>$comment.getBody()</p> #end
...