How to get templates for custom email by Script Runner


In the default notification scheme there are predefined email templates for issue created, issue updated and so on. They all are file stored in JIRA with the extension '.vm' and they look cool. Unfortunately they are triggered at predefined events. I want to send similar mail when my custom events occur. That is my requirement. How do I do it with script runner?

I searched the web the best I can. i can see snippets but no where there is a template as such. Say for issue created HTMl template. My main requirement is the template similar to the issue modified email that is sent by JIRA, as that requires picking all the modified fields dynamically and printing on screen.

Your help is greatly appreciated!!!



2 answers

But if you just need the standard templates, you can just make sure your workflow function fires some event, and that you have it in your notification scheme. There are two different cases where you might need Script Runner : 1) you have a very custom email template 2) you only want to send mail on a specific circumstance, eg a transition of a high priority issue.

Can you explain more about what you requirement is?

Hi Jamie, I have similar requirement, I need to use script post function as under basic notification scheme I do not have any option to add a user in cc, so he is getting a separate email instead of main mail going to DL and he should be in cc. Can you please help on this? Thanks, Priyanka

My company also wants to be able to use the JIRA email templates, but include all the users it's being sent to within the To/Cc fields instead of the email being sent to everyone individually. This way each member knows exactly who was sent the email. If there's a way to do this within ScriptRunner (or directly in the JIRA templates), that would be great!

I'm a bit confused, because in SR they are not send individually. Perhaps you are talking about the plain jira notifications?



I would like to create a groovy script that send an email to specific user using the VM email template (velocity)

Then I will add it as Restful endpoint to let the user use this script with their own condition

To give more explaination, some users as an excel file with user that as to be alerted when a new ticket is created, but it depends of specific field condition.

So  the user will develop a script that fit with his requirement,

 I will create a webhook on the creation issue, that will launch this script, and this script will use the Restfull endpoint to send the email to the specific user according to their condition 

As it I will delegate a lot of scripting to the end user.


How can I develop the script to use the VM template? what function should i use?


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

441 views 8 26
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you