...
Step 4: Configure the Action Script
Click the Edit Script link. Write this SIL code in new page.
Code Block title Action 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 provides the following actions:
- 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 of the
...
- Email Issue
...
- custom field.
- Sends the email with all the details filled by the user that send the email.
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 see the sendEmail routine.
...