Is there a list of available "variables" for the Email templates in script runner listeners?


we would like to send out custom emails, where the body of said email differs depending on the event (update, creation, commented) and where we can see the changes (in case of an updated ticket)

Unfortunately I seem to not be able to find any listing of possible variables to use in the Template.

Can anyone point me to the right direction on where to find (or generate) all possible variables?


1 answer

0 votes

There is not much more than what you can see in the example mail here:

"issue" should have most of what most people need.

There are a few variables for comments, but that's explained in the doc.

Is there a way to print changes or which event triggered the listener? At the moment I distinguish by "lastComment", but this will not work on a changed Ticket: {code} <% if (lastComment) { out << "The " << <<" https://jira/browse/"<<; issue.key << " with priority " << issue.priority?.name << " has been updated:\n" out << "Last comment: " << lastComment } else { out << "New " << <<" https://jira/browse/"; << issue.key << " with priority " << issue.priority?.name <<":\n" out << "-----------------------------------------------------\n" out << issue.description } %> {code}

Hi @Tobias Vollmer Were you able to get changes or events which triggered the listener? I am sending email for almost all events and would like to differentiate in the email body if possible. Any help would be appreciated!! Thanks

Hi @Bhupesh Nagda, unfortunately I was not able to get the changes. To the event triggered can be accessed with "event.eventTypeId". Please be aware that the use of this Variable will cause the Preview to throw an exception (as no event is triggered). We used the Eventtype in a switch statement: <% switch (event.eventTypeId) { case "1": //Created out << "has been created." break case "2": //Updated out << "has been updated." break case "5": //Closed out << "has been closed." break case "6": //Commented out << "has a new comment." break case "7": //Reopened out << "has been Reopened." break default: //Unknown out << "has triggered the event: " << event.eventTypeId } %> Cheers, Tobias

Thanks for the reply

The website is broken and there is no event object.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,117 views 13 19
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot