Email Issue

This post-function will send a notification email to specified recipients when the transition is triggered. You can create either plain text or HTML-formatted emails, and insert field values within those templates. See Email templates for more information on creating emails using the different templates available.

Configure the post-function

  1. Follow the steps above to add a post-function to a Transition.

  2. From the list of post-functions, select Email Issue.

  3. Click Add.

  4. The Email Issue page will open (Figure 1, right). Configure the post-function as needed, setting the options for the target issue, email template, email content, and additional options as necessary. See below for details on each of the configurations.

  5. Click Add.

Note that you need to publish the workflow for the new post-function to take effect.

Email template

In the Email template section, you configure which issue will be included in the email and the template to use. The HTML/text body of the message (see Email content, below) will appear inside the selected template. See Email templates for more information on creating emails using the different templates available.

  • Target issues

    • Which issue(s) - Select the issue type.

      • Current Issue - The issue that is being transitioned and triggering the post-function.

      • Issue/Subtask

        • Sub-tasks of the current issue - Updates will be made to all sub-tasks of the current issue.

        • Parent issue of the current sub-task - Updates will be made only to the parent of the current issue (if any).

      • Epic/Story

        • Issues that belong to the current Epic - Updates will be made to all issues that belong to the current Epic.

        • Epic of the current issue - Updates will be made only to the Epic of the current issue (if any).

      • Portfolio Parent/Child

        • Child issues of the current issue in the Portfolio hierarchy - All child issues will be updated.

        • Parent issue of the current issue in the Portfolio hierarchy - Only the parent issue will be updated.

      • Issue links

        • Issues linked to the current issue through any link type

        • Issues linked to the current issue through the following link type

      • JQL / Groovy

        • Issues returned by the following Groovy script

        • Issues returned by the following JQL search

    • Issue Link - Only available when Which issue(s), above, is set to Issues linked to the current issue through the following link type. Select the required link type between the current issue and the issue to be updated.

    • Groovy script - Only available when Which issue(s), above, is set to Issues returned by the following Groovy script. Enter a Groovy script that returns the ID values for the issue or issues to be updated. See Customizing further with Groovy scripts for more information on Groovy scripting.

    • JQL expression - Only available when Which issue(s), above, is set to Issues returned by the following JQL search. Enter a JQL expression that returns the ID values for the issue or issues to be updated. See Using JQL in JMWE for more information on JQL.

    • Pick a Template - Select the email template to use. See Email templates for more information.

Email content

Specify the subject and body of the email in this section. Click on the Expected value menu of the Groovy editor Help section for details on the expected value for the subject and the body.

Subject

Input the subject of the notification Email, including optional Groovy template markup. For example:  

Issue <%=issue.key %> - <%= issue.summary %> has been resolved
Immediate attention needed on <%=issue.key %>

Text Body

Input the raw text version of the body of the notification email. This will be used for users who have opted to receive emails in text format (see user preference settings) or if you do not provide an HTML version below, and the user preference is set to receive emails in an HTML format. The text body version of the email supports Markup, and will insert issue values when the issue field is preceded by a $ (e.g. $issue.summary will insert the issue summary).

For example:

Hi, _Greetings from Innovalog!_ Issue *$issue.key - $issue.summary* has been resolved. Regards, $currentUser.displayName.

Html Body

Input the HTML version of the body of the notification email. For example:

If you don't provide one, it will be generated automatically from the raw text version in Text Body, above, using the Atlassian wiki renderer. Note that you can include:

  • HTML-rendered field values using ${issue.getAsHtml("fieldNameOrId")}

  • an HTML-rendered version of the comment added on the transition screen, if any, using ${transientVars.commentHtml}

Note that in the Groovy tester for the HTML Body, a rendered version of the result is displayed as an HTML-rendered value.

Attachments

You can optionally add attachments to the email. You can include all of the issue's attachments, only the attachments added on the transition screen (if any), or even select attachments from the current issue or any other issue.

Note that image attachments referenced in the email body will be attached automatically and displayed in the email.

  • No attachments: No attachments will be included in the Email. This is the default option.

  • All issue attachments: All the attachments of the issue are attached to the email sent. If you want to send the attachment added on the transition screen move the post-function after the "Update change history for an issue and store the issue in the database" built-in post-function.

  • Attachments added on the transition screen: Only the attachments added on the transition screen are attached to the email sent. Please note: you need to move the post-function down after the "Creates the issue originally" (on a Create transition) or the "Update change history for an issue and store the issue in the database" post-function.

  • Attachments returned by a Groovy script: Input a Groovy script that returns either:

    • a number representing an attachment ID

    • an attachment object

    • a collection of attachment objects and/or attachment IDs

Examples:

  1. A number representing an attachment ID

  2. Attachment object

  3. A collection of attachment ID’s

  4. A collection of attachment objects

Recipients

The notification Email is sent to the recipients selected in this section.

  • Issue members - You can notify users who have standard roles related to the issue:

    • the Reporter

    • the Assignee

    • all Watchers of the issue

    • all Voters of the issue

  • Specific users - Select specific users who will receive the email notification.

  • Users in field(s) - Select one or more User Picker fields containing either users or usernames.

  • Users from script - Input a Groovy expression that returns either:

    • an ApplicationUser object

    • a Collection of ApplicationUser objects

    • a Collection of String containing usernames

    • or a comma-separated String of usernames

For example:

List of usernames: "jdoe,jblack"

An array of usernames: ["jdoe","jblack"]

To send to the users in a Multi-user picker field: issue.get("Multi User Picker")

  • Specific groups - Select a specific group or groups whose members will receive notifications.

  • Project role members - Notify members of specific Project roles.

  • Exclude users - The users returned by this Groovy script will be excluded from the recipient list. For this option, you can input a Groovy expression that returns:

    • an ApplicationUser object

    • a Collection of ApplicationUser objects

    • a Collection of String containing usernames

    • or a comma-separated String of usernames

For example, if you want to send a notification email to all the members of a project role except one, then you can select the Project role above and input the username of the user to be excluded here. Here are some more examples:

  • Email addresses: You can either type a comma-separated list of email addresses or a Groovy Template markup to fetch the email addresses from a field. For example:

    • A single email address: john@acme.com

    • A list of email addresses: jim@acom.com,joe@acme.com

    • An email address in a custom field: ${issue.get('Email field')}

    • The email addresses of users in the jira-administrators group: ${ComponentAccessor.groupManager.getUserNamesInGroup("jira-administrators").join(",")}

The user executing the post-function (by default the Current user) will not receive any notification unless they select the "Notify me of my changes" option on their User Preferences page.

Sender

By default, the notification email will be sent from the current user (the user who triggers the transition), unless specified otherwise:

  • Sender - Specify an explicit Jira user to be the sender of the notification email (the “from” name and email address).

  • Override sender name - Replace the sender name with a specific string. Note that this string can contain Groovy Template markup to insert dynamic content in the string.

  • Override sender email address - Replace the sender email address with a specific string. Note that this string can contain Groovy Template markup to insert dynamic content in the string.

Reply to

By default, replies to the notification email will go to the email address of the sender.

  • Reply to Jira - If you check this box, replies will go instead to the email address specified for the current issue's project, or to Jira's global incoming email handler.

Conditional execution

Error Handling

On This Page

Figure 1 - Email Issue post-function