Versions Compared

Key

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

...

One of the most typical requirements is to send files attached with the latest comment in Jira or ServiceDesk JSM to customer email.

In Jira or SD JSM comment, files can be added as regular attachments or inline. Moreover, when adding file inline, it could contain both - an optional thumbnail in the comment text and the full version which will open when clicking on the thumbnail. Normally, the Jira or SD JSM will require user to log-in to the portal to download the attachments.

With Raley Emails Notifications you can handle comment attachments much better - all of them will be added as first class email attachments (both regular and inline). This code snippet below will do the magic for you:

Code Block
linenumberstrue
#foreach ($att in $issue.lastcomment.attachments)
   $jirassimo.includeAttachment($att.id) 
#end


Sending attachments from issue description

Code Block
linenumberstrue
#foreach ($att in $issue.renderedFields.descriptionAttachments)
   $jirassimo.includeAttachment($att.id) 
#end

Attaching files added during workflow transition

In Jira you can configure your workflow transition in such a way that user will be asked to provide a comment when transiting the ticket. Here's an Atlassian article explaining how to do that: https://confluence.atlassian.com/jirakb/how-to-add-a-comment-during-a-transition-779160682.html

But you can also add a file upload functionality there, so, the user can upload a new file together with comment when executing a transition. This file is not a part of the last comment and if you want to send it via email, then use the following code snippet

...

Code Block
linenumberstrue
$jirassimo.includeAttachmentincludeAttachments("")


Attaching ALL pdf files uploaded to specific ticket

Code Block
linenumberstrue
$jirassimo.includeAttachmentincludeAttachments("*.pdf")

Instead of "pdf" you can specify any other file extension


Attaching several types of files

Code Block
linenumberstrue
$jirassimo.includeAttachments("*.[pdf|doc]")

Will attach files of type pdf and doc

Attaching all files that satisfy specific condition

...

The snippet above will attach only those files which filename starts with the word "invoice". You can add any custom logic in Velocity format here to check against author, size limits, mimeType and and