Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

In a JIRA script, how do I render wiki text fields?

I have a Jython script which sends emails. Basically, stuff like:

from com.atlassian.jira import ComponentManager
from com.atlassian.jira.issue import CustomFieldManager
from com.atlassian.jira.issue.fields import CustomField
cfm = ComponentManager.getInstance().getCustomFieldManager()

change_summary = issue.getCustomFieldValue(cfm.getCustomFieldObjectByName("Change Summary"))

# Build a multipart email with text and html from template, and send it ...

Now, the trick is, the Change Summary custom field is configured for wiki text rendering. If at all possible, I would want to render that into text or html for the various parts.

Shopping around the API, it looks like I want to work from here:

... using render() for HTML and renderAsText() for text? I can probably figure this out, but if anyone can point to some existing example code, I would be most grateful.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted

Answer is actually over here:

Here is what Jython would look like:

from com.atlassian.jira.component import ComponentAccessor
from com.atlassian.event.api import EventPublisher
from com.atlassian.jira.util.velocity import VelocityRequestContextFactory
from import AtlassianWikiRenderer
eventPublisher = ComponentAccessor.getOSGiComponentInstanceOfType(EventPublisher)
velocityRequestContextFactory = ComponentAccessor.getOSGiComponentInstanceOfType(VelocityRequestContextFactory)
wikiRenderer = AtlassianWikiRenderer(eventPublisher, velocityRequestContextFactory)

change_summary_html = wikiRenderer.render(change_summary, None)
change_summary_text = wikiRenderer.renderAsText(change_summary, None)


Atlassian Community Events