Easy Email Newsflash for Jira

Easy Emails Newsflash for Jira, provides users with option to send custom newsflashes and/or newsletter type emails on issue workflow transitions, using custom templates.

This can be handy when you do not want to use an existing JIRA templates or wish to send emails/ newsletters/ newsflashes to external persons, that are not registered as users in your JIRA.

Installation

Install the app via the Atlassian Marketplace or follow the standard installation process through the UPM.

After a successful installation you can use template manager with template editor to create templates, and then use them in a post function where you can decide to whom to send the newsflash/email/newsletter.

Template Manager

To reach the template manager, log in as an admin, then go to CogManage appsPost Function Templates (left menu, Easy Email Newsflash section).

The template manager lists all created templates, including template name & description.

There are 4x Operations:

  1. Add - the user can click on the add button to create a new template. This action will redirect the user to the Template Editor

  2. Edit - modify newsflash/email template via Template Editor

  3. Clone - create new newsflash/email template using this template

  4. Delete - remove this newsflash/email template

Template Editor

The template editor enables the user to create a new or edit an existing email template.

The template editor has:

Name - template name

Description - template description

Body - text content of email template

Email Preview - enter an email address to test this template

Save - save the template

Cancel - delete the template

The subject of the letter that will be sent from the post function has the following format:

template_name [issue_key] issue_summary

Context

Since the email template is rendered during execution of a workflow post-function it has access to values set in this transition. If the workflow transition has a screen it will also see the values set in the form and comment added to the transition.

Objects below can be referenced in the template using Velocity expressions.

Context objects

  • ${issue} - [com.atlassian.jira.issue.IssueImpl] Issue object

  • ${description} - [String] Formatted issue description - wiki format already rendered to HTML

  • ${proj} - [com.atlassian.jira.project.ProjectImpl] Project object

  • ${project} - [org.ofbiz.core.entity.GenericValue] Project entity

  • ${pkey} - [String] Project Key

  • ${baseurl} - [String] Base URL of the application (ex. http://localhost:2990/jira)

  • ${userKey} - [String] Current user (user who triggered the transition)

  • ${comment} - [String] Comment submitted in the view

  • ${commentLevel} - [String] Comment submitted in the view

  • ${roleLevel} - [String] Comment submitted in the view

  • ${actionId} - [Integer] The transition ID number

  • ${cfUtils} - [lv.itidea.jira.plugins.workflow.pf.email.CustomFieldHelper] Plugin's utility class to help fetching the issue's customfield values

  • ${i18n} - [com.atlassian.jira.web.bean.I18nBean] Bean for accessing the message translations

  • ${currentMillis} - [java.lang.Long] current time in milliseconds

  • ${stringUtils} - [org.apache.commons.lang.StringUtils] Apache Commons utility class

  • ${dateTimes} - [com.atlassian.jira.datetime.DateTimeVelocityUtils] Provides methods for parsing Date

  • ${dates} - [com.atlassian.jira.datetime.DateVelocityUtils] Provides methods for parsing Date

  • ${dateFormatter} - [com.atlassian.jira.datetime.DateTimeFormatter] JIRA date time formatter class

  • ${dateTimeStyle} - [com.atlassian.jira.datetime.DateTimeStyle] JIRA Date Time Style enum

  • ${jirautils} - [com.atlassian.jira.util.JiraUtils] JIRA utility class

  • ${jirakeyutils} - [com.atlassian.jira.util.JiraKeyUtils] JIRA utility class

  • ${userutils} - [com.atlassian.jira.user.UserUtils] Bean for retrieving users

  • ${jiraUserUtils} - [com.atlassian.jira.user.util.UserUtil] Bean for retrieving users and groups

  • ${avatarService} - [com.atlassian.jira.avatar.AvatarService] JIRA Avatar service

  • ${externalLinkUtil} - [com.atlassian.jira.web.util.ExternalLinkUtil] JIRA external link utility class

  • ${cfValueEncoder} - [com.atlassian.jira.render.SwitchingEncoder] JIRA customfield value HTML encoder class

  • ${projectManager} - [com.atlassian.jira.project.ProjectManager] JIRA project manager

  • ${customFieldManager} - [com.atlassian.jira.issue.CustomFieldManager] JIRA custom field manager

  • ${constantsManager} - [com.atlassian.jira.config.ConstantsManager] JIRA constants manager

  • ${issueConstantWebComponent} - [com.atlassian.jira.web.component.IssueConstantWebComponent] JIRA constants image rendering class

  • ${velocityhelper} - [com.atlassian.jira.util.JiraVelocityHelper] JIRA Velocity helper class

  • ${urlcodec} - [com.atlassian.jira.util.JiraUrlCodec] JIRA URL query params encoding helper class

  • ${urlModeAbsolute} - [com.atlassian.plugin.webresource.UrlMode] Instance of UrlMode.ABSOLUTE enum

  • ${webResourceUrlProvider} - [com.atlassian.plugin.webresource.WebResourceUrlProvider] JIRA utility for formatting URLs

  • ${build} - [com.atlassian.jira.util.BuildUtilsInfo] JIRA build information class

  • ${textutils} - [com.opensymphony.util.TextUtils] Text utility class

  • ${xmlutils} - [com.atlassian.core.util.XMLUtils] XML utility class

Issue fields

  • ${issue.summary}

  • ${description} - Rendered version of ${issue.description} field

  • ${issue.description}

  • ${issue.assigneeId}

  • ${issue.assignee.displayName}

  • ${issue.reporterId}

  • ${issue.reporter.emailAddress}

  • ${issue.priority}

  • ${issue.priorityObject}

  • ${issue.created}

  • ${issue.updated}

  • ${issue.dueDate}

  • ${issue.resolutionDate}

  • ${issue.status}

  • ${issue.statusObject}

Issue custom fields

  • $!{cfUtils.getValue($issue, "customfield_10000")} - Retrieving string representation of customfield value or null

  • $!{cfUtils.getRenderedValue($issue, "customfield_10000")} - Retrieving rendered value of customfield or null

  • $!{cfUtils.getVal($issue, "customfield_10000")} - Retrieving actual value object of customfield value or null

Checkbox and Multiselect list values

These are values of type java.util.ArrayList.

  • $!{cfUtils.getVal($issue, "customfield_10000").get(0)} - Retrieving first selected option of checkbox or multiselectlist customfield (might be null!)

Radiobutton and Select list values

These are values of type com.atlassian.jira.issue.customfields.option.Option

  • $!{cfUtils.getVal($issue, "customfield_10000").getValue()} - Retrieving selected option name of radiobutton or (single) select list customfield (might be null!)

Cascading select list values

These are values of type java.util.HashMap.

  • $!{cfUtils.getVal($issue, "customfield_10000").get(null)} - Retrieving selected 1st level option of cascading select list customfield (might be null!)

  • $!{cfUtils.getVal($issue, "customfield_10000").get("1")} - Retrieving selected 2nd level option of cascading select list customfield (might be null!)

Current user username

  • ${userKey}

Comment provided with transition

  • ${comment}

Sample Template

Here is an example of email template code, that can be used with this app.

It shows a sample of basic options that are available.

#!html
 
<p>This is ticket <b>${issue.key}</b> from <b>${issue.project.name}.</b></p>
<p>And you have to do:
$!{issue.summary}
</p>
<p>How to do it:
#if (${issue.description})
${issue.description}
#else
is not defined.
#end
</p>
<p><b>Problem:</b> $!{cfUtils.getValue($issue, "customfield_10000")}</p>
<p><b>Steps to reproduce:</b> $!{cfUtils.getRenderedValue($issue, "customfield_10001")}</p>
<p><b>Remote user:</b> $!{cfUtils.getValue($issue, "customfield_10003")}</p>
<p><b>Tags:</b> $!{cfUtils.getValue($issue, "customfield_10004")}</p>
 
#if ($comment) 
<p> 
<b>${userKey}</b> commented: $comment 
</p>
#end
 
<p>Have a nice day!</br>
${issue.reporter.displayName}
</p>

Post Function

After creating templates, you can use them in post functions. Open the edit for the desired process transition and add a post function called “Send email notification“. The post function editing form will appear:

Here you can:

  • Select email recipients

    • User(s). Comma separated list of users who will receive the email. Click the icon to the right of the field to find users.

    • Group(s). Comma separated list of groups in which all users will receive an email. Click the icon to the right of the field to find groups.

    • User(s) within user fields. These are the following types of fields: User Picker (single user), User Picker (multiple users) and Group Picker (multiple groups). If the selected field is present in the current issue and it is filled in, then users located in this field, or in a group located in this field, will receive an email.

    • Text fields containing email. You can create a text custom field that will store a custom email address. If such a field exists, select it in this field and an email will be sent to the address specified there.

  • Determine whether attachments to the current task should be included in the email. In the “Include attachments“ field select:

    • None. Attachments to an issue will not be included in the email.

    • New. Only attachments added during the current transition will be added to the email.

    • All. All issue attachments will be added to the email.

  • Select a template.