You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
In our workflow we have a transition called "Ship product". During this transition an email is sent to our shipping location that has instructions on how to ship a requested product. Included in that email is a shipping label and occasionally if our customer requires it, a cover letter. I wish I could use the include all attachments option but sometimes the issue has attachments other than the shipping label and cover letter like their company logo from their email replies. I don't want those to be emailed to the shipping dept because anything attached to the email will end up printed and included in the package. So since the shipping labels are always pdf files and the cover letters are always Word files, I tried to use the custom option.
Using the snippet example I was able to get either the pdf to send or the doc file but I couldn't get them both to send and I couldn't figure out how to manipulate it to send them both. Is it not possible?
I assume you are using ScriptRunner's Send Custom Email Post-Function for your requirement.
If yes, you can follow the steps below:-
1. First, ensure that you have selected the Custom option in the Include Attachments section.
2. Add the code below into the Custom Attachments Callback field:-
import com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.mail.MailAttachment
{
MailAttachment a ->
def filename = a.filename.toLowerCase()
filename.endsWith('.pdf') || filename.endsWith('.docx') || filename.endsWitch('.doc')
}
Please note that the working custom code above is not 100% exact to your environment. Hence, you will need to make the required modifications.
Below is a screenshot for your reference:-
Below are a couple of test screenshots:-
1. In the sample issue, there are a couple of attachments included, i.e. png, pdf and doc file types as shown in the screenshot below:-
2. Once the issue transitions to In Progress, the mail is triggered. However in the mail as expected, only the pdf and docx file types are included as shown in the screenshots below:-
I hope this helps to answer your question. :-)
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you provide the code you've come up with so far? It's easier to help you troubleshoot
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.