How to display wiki markup in script custom email?

Goodgame Studios 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

1 vote
Answer accepted
Goodgame Studios 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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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)}

Suggest an answer

Log in or Sign up to answer