Hi folks,
I have a script post-function that uses the builin send email function.
In the function I render out the description field like this:
<td colspan="2">$issue.description</td> </tr>
The trouble is the description contains Wiki Markup which does not get converted to html.
What do I need to do to get the description to render as html ?
thanks
Thanks Jamie & Kostas - I finally got it working by embeding the full namespace:
<% 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) %>
<%= desc %>
Ahh finally sussed it - just need to explicitly state the paths thanks Jamie & Kostas.
<% 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) %> <%= desc %>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
how the path should look like by custom field (free text)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can do it like this:
def rendererManager = ComponentAccessor.getComponent(RendererManager.class) def fieldLayoutItem = ComponentAccessor.getFieldLayoutManager().getFieldLayout(issue).getFieldLayoutItem("comment") def renderer = rendererManager.getRendererForField(fieldLayoutItem) renderer.render(issue.description, null)
Convert that to a gstringtemplate is a pain though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jamie - so basically I have to write a dedicated script unless there is a way to use the import satements?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie, I want to send email to project role which consists of two words separated by space character "Portfolio manager". How to do so? Documentation says that more entries should be separated by space. I tried role:'Portfolio manager' and also 'role:Portfolio manager' but I was unsuccessful. Please help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check the following questions
https://answers.atlassian.com/questions/135084/method-to-convert-jira-wiki-format-to-html
https://answers.atlassian.com/questions/228579/html-to-wiki-style-renderer-markup
The solution provided in the first question works for me.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the quick answer :)
I think I must be missing something though. I have added the following to the email template section of the built in script:
<% EventPublisher eventPublisher = ComponentAccessor.getOSGiComponentInstanceOfType(EventPublisher.class); VelocityRequestContextFactory velocityRequestContextFactory = ComponentAccessor.getOSGiComponentInstanceOfType(VelocityRequestContextFactory.class); AtlassianWikiRenderer wikiRenderer = new AtlassianWikiRenderer(eventPublisher, velocityRequestContextFactory); String html = wikiRenderer.render("*I am bold*", null); %>
but I get unable to resolve class EventPublisher
unable to resolve class VelocityRequestContextFactory
unable to resolve class AtlassianWikiRenderer
How do I get the imports in to the email template section ? or do I have to write a custom script?
cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just add the missing classes
import groovy.text.GStringTemplateEngine; import com.atlassian.jira.issue.fields.renderer.wiki.AtlassianWikiRenderer; import com.atlassian.jira.util.velocity.VelocityRequestContextFactory; import com.atlassian.event.api.EventPublisher;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried that but if you put imports inside of a GString template you get an error:
Unknown type: IMPORT at line: 25 column: 1. File: GStringTemplateScript217.groov
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.