Versions Compared

Key

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

...

Info
titleAvailability

This routine is available since JJUPIN Power Scripts 4.0.0

Syntax

attachFileFromEmail(attachmentName, issueKey)

Description

Excerpt

Attaches a single file from the incoming email to a specific issue.

...

ParameterTypeRequiredDescription
attachmentNamestringYesThe name of the attachment from the incoming email. (warning) (warning) Note that if there are multiple attachments withthe same name, this will always attach the first one in the list.
issueKey

string

YesThe issue to attach the file to.

...

Code Block
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

Filter by label (Content by label)
showLabelsfalse
max35
cqllabel = "mail_handler_routines"
labelsjira_comment_routine