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

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

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.

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}

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 Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,723 views 17 21
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