Hey,
I was following Script Runner documentation to take the Description field and render it as Wiki in the email. I've used
{${helper.render(issue.description)}
But I get the following error when I try to preview (or in the log):
2016-10-10 13:18:35,487 http-bio-8080-exec-6919 ERROR Peter.b 798x4556140x3 12f2645 172.29.20.173,0:0:0:0:0:0:0:1 /rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail/preview [common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: No such property: helper for class: groovy.lang.Binding groovy.lang.MissingPropertyException: No such property: helper for class: groovy.lang.Binding
I'm using JIRA 6.3.12 and Script Runner 3.0.16
Aha!
The helper variable in the binding is only available in 4.1.3.17 and beyond. For JIRA 7 users, you'll want to use 4.3.7 and beyond.
https://scriptrunner.adaptavist.com/4.1.3.17/jira/builtin-scripts.html#_send_a_custom_email
This was part of the rewrite of the Send Custom Email postfunction we did back in July to add features like this.
Thanks Jonny for the investigation.
Any case you are aware of any other function I could use until upgrading to JIRA 7 so that my description field will show more like the original? No wiki formatting, but at least if the description has like few separate lines, I'd like to see this in the email too. Now I get the text from Description field in 1 single like of text).
Example - keep this kind format in the email:
This is the issues.
Please investigate. Further data:
bla
bla
bla
Instead of: This is the issues. Please investigate. Further data: bla bla bla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you have any workaround for this for JIRA 6.3??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
for Jira 6.3 simply paste the following code in "E-mail template" part:
<%=
def rendererManager = com.atlassian.jira.component.ComponentAccessor.getComponent( com.atlassian.jira.issue.RendererManager.class)
def fieldLayoutItem = com.atlassian.jira.component.ComponentAccessor.getFieldLayoutManager().getFieldLayout(issue).getFieldLayoutItem("description")
def renderer = rendererManager.getRendererForField(fieldLayoutItem)
String desc = renderer.render(issue.description, null)
%>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm investigating this now.
I've noticed that in the version-specific documentation, we don't mention the helper:
https://scriptrunner.adaptavist.com/4.1.3.15/jira/builtin-scripts.html#_send_a_custom_email
I'd hazard that's deliberate. It well may be that this only works in JIRA 7.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Getting the same error with Script Runner 4.1.3.15
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.