How can i share the issue key in an e-mail which is send after a transition from status A to B? Edited

Hello, my goal is to send the issue-key in an e-mail when my warranty for my hardware expires?

 

Whats the syntax in the EMail template to send the key from the issue and how can i send custom fields?ScriptRunner.PNG

2 answers

1 accepted

1 vote
Alexey Matveev Community Champion Dec 08, 2017

Hello, 

Write in email template

Your asset <% out << issue.key %> has no warranty.

Will try it! Thanks

It worked great! Can i put this asset into a link? When i click on it - it will display the issue?

 

Is this possible?

Alexey Matveev Community Champion Dec 11, 2017

Try something like this 

Your asset <a href="http://jiraurl/browse/><% out << issue.key %>"><% out << issue.key %><a/> has no warranty.

Will try it out. 

When i click on the link i get an error message. DNS problems...hmm

 

Unbenannt.PNG

Alexey Matveev Community Champion Dec 11, 2017

Kindly change your code to

Your asset <a href="http://jiraurl/browse/<% out << issue.key %>"><% out << issue.key %></a> has no warranty.

And change jiraurl to your jira url

Thanks for your help! It works perfect!

http://jiraurl/browse/<% out << issue.key %>

This is enough for my email ;)

I used a slightly different approach that some may find useful. I defined the URL for the link as such:


<%
def link = com.atlassian.jira.component.ComponentAccessor.getApplicationProperties().getString("jira.baseurl") + "/browse/" + issue.key
%>


and then referenced that variable in the email template as such:


<p>Please note that <a href="$link">$issue.key</a> has been canceled.</p>


Doing it this way allows easily moving the script between our dev/test/prod instances and always having the correct URL, and secondly, I find it cleaner to user $issue.key rather than <% out << issue.key %>

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,293 views 14 20
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