The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

How to display wiki markup in script custom email?

Goodgame Studios
Contributor
August 6, 2015

I would like to convert wiki markup from custom field (free text) to HTML by the script runner post function - send custom email.

How would the path look like?
Now I have the wiki style:

<% out <<
issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("Expected Problems")) %>

2015-08-07_11h51_49.png

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Goodgame Studios
Contributor
August 7, 2015

I have resolved this issue smile

<% 
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(componentManager.getCustomFieldManager().getCustomFieldObjectByName("field name"))
def renderer = rendererManager.getRendererForField(fieldLayoutItem)
String desc = renderer.render(issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("field name")), null)
%>
<%= desc %>
0 votes
Fazila Ashraf
Community Champion
November 4, 2020

For any one who was looking for a solution on this, scriptrunner documentation has a latest solution. See https://scriptrunner.adaptavist.com/5.0.9/jira/builtin-scripts.html#_send_a_custom_email

If you are sending HTML mails you will want fields containing wiki markup to be converted to HTML. You can use the following code in your templates.

${helper.render(issue.description)}