Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 5

The use of this routine requires the Power Scripts for Jira add-on be installed and licensed.

Table plus
applyColStyleToCelltrue
heading0
columnTypess,s,s,s
multiplefalse
columnAttributesstyle="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,
enableSortingfalse

Syntax

attachFileFromEmail(attachmentName, issueKey)

Package

Alias

Pkg Usage

Description

Excerpt
hiddentrue
Attaches a single file from the incoming email to a specified issue.

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

Parameters

Table plus
applyColStyleToCelltrue
columnTypess,s,s,s
heading0
multiplefalse
enableSortingfalse

Parameter name

Type

Required

Description

attachmentName

string

Yes

The name of the attachment from the incoming email. Note that if there are multiple attachments with the 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

Returns "true" if file was successfully attached to issue and "false" otherwise.

Example

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
max25
showSpacefalse
cqllabel = "mail_handler_routine" and space = currentSpace ( )
labelsarray_routines

We've encountered an issue exporting this macro. Please try exporting this page again later.