Versions Compared

Key

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

...

  • Choose the cog icon at right of the screen for 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 the Edit Buttons link. You will find it on the bottom of the page in the section named Buttons.
  • Add New Blitz Action by creating a Button Text called: "Send Email". Press the Add button.
  • At the end of this operation you'll see 5 links for this button in the right of the screen.
  • The first three of them are the SIL scripts that controls it.
  • The first script, named Condition Script, contains the condition for the button visibility. The default value is visible, so if you want all the user to see and action this button you can let the default script.
  • The second Script, named Screen Script, allows you to determine if the send email action requires additional data and builds a form that the user can fill in.
  • The third Script , named Action Script, sends the email you'll want to the specified email addresses.

Step 3: Configure the Blitz Screen Script

In order to send the email you will need to configure the Blitz Action Scripts.

As we said previously, the Condition Script can be configure in order to prevent certain users to send the emails. For more information please use the Condition Script page.

The Screen Script is used to show a message on the screen in order to confirm the email sending action. This is a security measure to prevent an accidental click on this button.

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

Code Block
titleScreen Script
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 a read only message in the screen.

Step 4: Configure the Blitz Action Script

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

Code Block
titleAction Script
string[] to = projectMembers(project);
string[] cc;
string subject = arraysConcat("JIRA Email Issue: ", summary);
string template = "template.tpl";
string language = "en_US";
print(attachments);
if (sendEmail(currentUser(), to, cc, subject, template, language, attachments))
{
 return "The email has been send 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 sending an email using SIL please read the sendEmail routine page.

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

Step 5: Build the email template

After the installation of the plugin, in the "Administration" menu, a new option will appear named "Kepler General Parameters". Go there and select "katl-commons" plugin from the Select plugin list. A configuration option named "Email Template Directory" depicts the directory where  the templates are kept. 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 Mail Server).

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

Code Block
titleEmail Template
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.