Skip to end of banner
Go to start of banner

attachFileFromEmail

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Availability

This routine is available since JJUPIN 4.0.0

Syntax

attachFileFromEmail(attachmentName, issueKey)

Description

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

Parameters

ParameterTypeRequiredDescription
attachmentNamestringYesThe name of the attachment from the incoming email. (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.


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:

  • No labels