Availability
This routine is available starting with Power Scripts 4.0.0
Syntax
attachFileFromEmail(attachmentName, issueKey)
Description
Attaches a single file from the incoming email to a specific issue.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
attachmentName | string | Yes | The name of the attachment from the incoming email. Note that if there are multiple attachments withthe same name, this will always attach the first one in the list. |
issueKey | string | Yes | The issue to attach the file to. |
Return type
boolean
true if file was successfully attached to issue; false otherwise
Example
IncomingEmail email = getIncomingEmail(); string issueKey = matchText(email.subject, "[A-Z][A-Z]+-[0-9]+"); // find an issue key in the subject if(isNotNull(issueKey)) { for(string att in email.attachments) { // only attach PDFs if(endsWith(att, ".pdf")) { attachFileFromEmail(att, issueKey); } } }
See also
-
getIncomingEmail (Power Scripts™ for Jira 4.0)
-
attachFileFromEmail (Power Scripts™ for Jira 4.0)
-
attachAllFilesFromEmail (Power Scripts™ for Jira 4.0)
-
saveAttachmentFromEmail (Power Scripts™ for Jira 4.0)