How to add dynamically generated email attachments to custom emails sent by ScriptRunner?

Midori
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2016

We are trying to send out custom emails, as described here, but we want to attachments to the email that are not issue attachments! According to this section, we can add all or a subset of the issue attachments to the email, but it is not mentioned how to add "custom" attachment.

For example, is this possible to dynamically generate (in the Groovy scripts) an email attachment called "myatt.txt" containing the text "Hello world"? Does anyone have a working example?

(One workaround could be using multiple post-functions on the workflow transition, the first to generate our custom attachment and actually add that to the issue, the second to send out the email with the attachment added in the previous step, and a third one to delete this temporary attachment. But, this sounds lame, may introduce timing problem, may generate unwanted emails, etc.)

1 answer

1 accepted

0 votes
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2016

We're currently rewriting that functionality - it is not now, but it will be possible to get hold of the Email object using a code section, where you will be able to add emails in advance of the script processing it.

It's currently being done under SRJIRA-1377. Please could we revisit this when the release containing that goes out...

Midori
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 29, 2016

Thanks, Jamie.

Adrián Plaza November 18, 2016

Hi Jaime, please can you add my user "aplaza", like participant in this issue.

Thanks.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 18, 2016

Adrian, I don't really understand, the issue is resolved and released, and it's a public issue anyway.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 18, 2016

Oh my mistake, it was private, it's public now.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events