Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Problem

In certain situations some , users needs need to be informed about new issues or changes in the issue fields by the project manager or other users with specific roles in the project. Also, these emails are not to shouldn’t be automatically sent because not all the changes or issues need an email notification.

Our You can use Power Actions for Jira app offers you a very simple solution  app to build and send emails to all or certain project members at a click of a button.

This solution presents one of many that the Simple Issue Language Reference and Power Actions for Jira can implement.

You can simply let your imagination run free ...

Solution

In order to solve this issue you will have to

Solution

To solve this issue, use a Power Actions™ custom field that builds creates an email via based on a template, and sends it to its the recipients.

Step 1: Create a new Power Actions™ Custom Field

The first step consists in creating First, create a new Power Actions™ custom filed, as followsfield following the instructions below:

  • Go to the Administration page.

  • In On this page, go to the Issue section.

  • Here you will find a link named Custom Fields; you should click on it.

  • Add a new custom field from the button in the right top of the screen ("Add Custom Field").

  • Choose Click the Custom Fields link.

  • Click the Add Custom Field button in the upper-right corner to add a new custom field.

  • Select the Power Actions™ Custom Field option and press . Select Next.

  • Name this newly created Rename the new custom field : "to Email Issue".

  • Choose Selectyour applicable issue types and applicable context in order to view the new created custom field only on certain issues and projects - , as you desirepreferred. By default, the custom field is visible in global context.

  • Click Finish.

Step 2: Configure your Power Actions™ Custom Field

Configure Email Issue custom field by doing the following:

  • Choose Select the cog icon at right of the screen for  on the right. Go to the Custom Fields page to find your "Email Issue" custom field. This can be done by going to the Custom Fields page.

  • Click the Configure link.

  • Now we'll need to create a button that will trigger the email sending action.

  • Click on Go to the Edit Buttons link. You will find it on Buttons section at the bottom of the page in . Click the section named Edit Buttons link.

  • Create a button text to Add New Power Actions™ by creating a Button Text called: ".

  • Rename the new button to Send Email". Press the Click Add button.

  • At the end of this operation you'll see 5 this point, five links for this button in are displayed on the right of the screenpage. The first three of them are the SIL scripts that controls control it. They are:

    • The

    first script, named
    • Condition Script

    ,
    • script. It contains the condition for the button visibility. The default value is visible

    , so if you want all
    • (the user

    to
    • can see and

    action
    • click this button

    you can let the default script
    • ).

    • The

    second Script, named
    • Screen Script

    ,
    • script. It allows you to determine if the

    send
    • sending email action requires additional data.

    • The

    third Script , named
    • Action Script

    ,
    • script. It sends the email you

    'll want
    • prefer to the specified email addresses.

Step 3: Configure the Power Actions™ Screen Script

In order to To send the email you will need to configure the Power Actions™ Scripts.As we said previously, the

Info

The Condition Script can be

configure in order

configured to prevent certain users to send the emails. For more information

please use

, go to the Condition Script page.
The Screen Script is used to

show

display a message

on the screen in order

to confirm the email sending action. This is a security measure to prevent an accidental click

on

of this button.

To edit this the script, click the Screen Script link from on the Configure Email Issue page. Add the following code:

Screen Script
Code Block
string[] ret;
ret = BA_createInput("Message", "You are about to send a email message to all members of this project.", true);
return ret;

This code will show displays a read-only message in the screen.

Step 4: Configure the Power Actions™ Script

The Action Script is the one that sends the email to the desired specific users. To edit the Action Script, click the Script link from on the Configure Email Issue page and  add . Add the following code:

Action Script
Code Block
string[] to = projectMembers(project);
string[] cc;
string subject = "JIRA Email Issue: " + summary;
string template = "template.tpl";
string language = "en_US";
print(attachments);
if (sendEmail(userEmailAddress(currentUser()), to, cc, subject, template, language, attachments))
{
 return "The email has been sent succesfuly";
}
else
{
 return "An error occured when sending the email.";
} 

This code sends a template email to all the project members including the current user. For more information about on sending an email using SIL™ please read , go to the sendEmail page.

Because we an email template was used in the previous code a email template we'll need to , create and use this template named:renamed to template.tpl.

Step 5: Build the email template

After the installation of the plugin, in the "Administration" menuplugin installation, a new option will appear named "Kepler General Parameters" option is displayed.

Go there to the option and select "the katl-commons" plugin from the Select plugin list. A configuration option named "

The Email Template Directory" depicts the directory where  the configuration option indicates the folder where the templates are keptstored. The directory path is relative to the jira.home.dir/kepler. The rest of the email configuration is extracted from the standard JIRA configuration (Administration->Mail Servers->SMTP you can find this at Administration>Mail Servers>SMTP Mail Server).

You can create a new template in this folder using your desired preferred text editor. You can add certain issue field values in to the template by using the $field$ notation, where field is the field name of the field you want to put in enter into the text. Here is an example:

Email Template
Code Block
Hello $recipient$,
 
This is a test template sent from $assignee$'s issue $key$. The summary for this issue is: $summary$.
This issue has the following fields:

 Type : $type$
 Priority : $priority$
 Labels : $labels$
 Status : $status$
 Resolution : $resolution$

 $key$ is described as follows: 
 $description$
 
This issue was created on $created$ and updated on $updated$. It's due date is: $dueDate$. The assignee is $assignee$ and the reporter is: $reporter$.

Best regards,
$reporter$

This email was automaticaly generated by the JIRA Blitz-Action plugin:
https://marketplace.atlassian.com/plugins/com.keplerrominfo.jira.plugins.blitz-actions
or
http://jira-plugins.kepler-rominfo.com. 
Please do not reply.
Info

Email Templates

You can consult For more information, go to the Email Templates page for further information. Also consult and the Mail Configuration page pages.

Test

You can now test this custom field by going to the issues you have selected in the first step of this recipe.

The Issue screen will have now displays the Send Email button, like this:

After you click Click the button you'll need to and confirm your email:

Click the Execute button and the email will be sent.That's all. You just saved 100 US dollars, so for sure you can eat at least a chocolate bar to send the email.

Table of Contents

Table of Contents