Versions Compared

Key

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

...

Step 4: Configure the Action Script

  1. Click

...

  1. the Edit Script link.

...

  1. Write this SIL code

...

  1. in new page.

Code Block
titleAction Script
string[] to = replace(BA_getSingleValue(argv, "Send to"), ",", "|");
string[] cc = replace(BA_getSingleValue(argv, "CC"), ",", "|");
string subject = BA_getSingleValue(argv, "Subject");
string body = BA_getSingleValue(argv, "Email body");
string[] attachments = BA_getMultiValues(argv, "Attachments");
return sendEmail(userEmailAddress(currentUser()), to, cc, subject, body,"en_US", attachments);

This code makes provides the following operationsactions:

  • Takes the email addresses that the user filled in and if there are more than one email creates a list with all of them.
  • Gets the subject of the email.
  • Builds the body of the message by using a template or by creating the email body from the text that the user filled in.
  • Gets the paths from the attachments from the "Attachments" field  field of the Email Issue custom field.
  • Sends the email with all the details filled by the user that send the email.

As we previously said Note, we can use a template for the email which means that we have to create a template file that contains all the relevant fields of the issue. Also, for more information about sending an email using SIL consult see the sendEmailsendEmailroutine page.

Step 5: Build the email template

...