Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Email Issue

Are you using JMWE for Cloud and want to learn how to use this post-function? Head to our documentation here.

 

A post-function that will send an email to certain recipients specified in the post-function configuration.

To add 'Email issue' post-function to a transition: 

  1. Click Edit for the workflow that has the transition you wish to add the post-function on.

  2. In the Workflow Designer, select the transition.

  3. Click on Post Functions in the properties panel.

  4. Click on Add post function.

  5. Select Email issue from the list of post-functions.

  6. Click on Add to add the post-function on the transition.

  7. Select an email template. 

  8. Input the subject of the Email in Subject.

  9. Select the recipients in Recipients

  10. Click on Add to add the post-function to the transition.

Note that you need to publish the workflow

 

When you add this post-function to a transition and trigger the transition, the add-on sends an Email notification to the specified recipients.

Email template

Select an Email template to use for the Email. The HTML/text body (see below) will appear inside the selected template. More information on using the templates is documented in https://innovalog.atlassian.net/wiki/x/CoAHQQ.

Email content

Specify the subject and body of the email in this section. Click on the Expected value of the Groovy editor help to know 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. 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 above, using the Atlassian wiki renderer. Note that you can include:

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

  • 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 a 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 arbitrary attachments from the current issue or any other issue.

  • 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. You need to moved 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 the Reporter, Assignee, Watchers and Voters of the issue using this option

Specific users: You can notify specific users using this option.

Users in field(s): You can select one or more fields containing either users or usernames to notify

Users from script: 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 and notifies the returned users using this option. Here are a few examples:

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: You can notify members of specific groups using this option.

Project role members: You can notify members of specific Project roles using this option.

Exclude users: 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 and notifies the returned users using this option. The resultant users will be excluded from the recipient list. For example, 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:

List of usernames: "jdoe,jblack"

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

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

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, 

To an email address: john@acme.com

To a list of email address: jim@acom.com,joe@acme.com

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

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

Customize this post-function using the additional options provided as part of the post-function. The options are:

Sender

By default, the notification email will be sent from the current user, unless specified otherwise:

Sender: you can specify an explicit Jira user to be the sender (“from” name and email address) of the notification email.

Override sender name: you can 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: you can 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 Jira

By default, replies to the notification email will go to the email address of the sender. 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

To execute this post-function based on the result of a Groovy condition see Conditional execution/validation using a Groovy expression.

Error Handling

By default, all errors (Java Exceptions) raised by this post-function, including those raised by custom Groovy scripts, will be logged in the JIRA log file but will not be reported to the user and will not prevent the transition from completing. However, when designing new workflows or troubleshooting them, it is more convenient to be notified immediately of any such error during the execution of the transition. For example, on the production Jira instances, you might want to show errors only for the post-function(s) being worked on, in order to avoid disrupting other workflows. To make errors raised by the current post-function prevent the transition from completing and show the error in the browser, select Make transition fail when an error occurs in this post-function.

If you want to show all the errors, either only to the admins or to all users, configure the option globally on the JMWE configuration page. For example, on development and staging Jira instances, you can activate error reporting for all JMWE post-functions, to display all the errors and it is recommended to do so, and on production Jira instances you might want to activate error reporting only to administrators so that they can be made aware of configuration errors.