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

Tobias_Vollmer September 30, 2014

Hi,

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
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.
October 1, 2014

There is not much more than what you can see in the example mail here: https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Sendacustomemail

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

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

Tobias_Vollmer October 1, 2014

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 " << issue.issueType.name <<" https://jira/browse/"<<; issue.key << " with priority " << issue.priority?.name << " has been updated:\n" out << "Last comment: " << lastComment } else { out << "New " << issue.issueType.name <<" https://jira/browse/"; << issue.key << " with priority " << issue.priority?.name <<":\n" out << "-----------------------------------------------------\n" out << issue.description } %> {code}

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.
October 2, 2014

You can look at event.eventTypeId, which corresponds with one of these: https://developer.atlassian.com/static/javadoc/jira/6.3/reference/com/atlassian/jira/event/type/EventType.html

Bhupesh Nagda November 3, 2014

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

Tobias_Vollmer November 5, 2014

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

Bhupesh Nagda November 5, 2014

Thanks for the reply

Adam Arold [Midori] July 26, 2016

The website is broken and there is no event object.

Suggest an answer

Log in or Sign up to answer