Hi!
I have written the following Groovy-script using Scripted fields:
------------------------------
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.FieldManager;
import com.atlassian.jira.issue.RendererManager;
def rendererManager = ComponentAccessor.getComponent( com.atlassian.jira.issue.RendererManager.class)
def fieldLayoutItem = ComponentAccessor.getFieldLayoutManager().getFieldLayout(issue).getFieldLayoutItem("description")
def renderer = rendererManager.getRendererForField(fieldLayoutItem)
String desc = renderer.render(issue.getDescription(), null)
return desc
--------------------------------
which fetches the description-field in a JIRA issue and renders it as HTML. However, some of the descriptions contain images and these are not shown correctly. These pictures are completely empty. Is there a way to fix this?
Hi Andreas,
fieldLayoutItem was defined in your code.
And you're right about the latter one, it has three args.
Assuming you have the issue, the final code should be like this:
import com.atlassian.jira.issue.fields.NavigableField
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.FieldManager;
import com.atlassian.jira.issue.RendererManager;
def fieldLayoutItem = ComponentAccessor.getFieldLayoutManager().getFieldLayout(issue).getFieldLayoutItem("description")
Field field = fieldManager.getField("description")
NavigableField navigableField = (NavigableField)field
return navigableField.getColumnViewHtml(fieldLayoutItem, new HashMap(), issue)
I'm not sure but please try below code. I did not test it, just give it a try
It may give a clue
import com.atlassian.jira.issue.fields.NavigableField
Field field = fieldManager.getField("description")
NavigableField navigableField = (NavigableField)field
return navigableField.getColumnViewHtml(fieldLayoutItem)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for answering so quickly.
I can't see that you have defined the variable "fieldLayoutItem" anywhere. Also, from the API it seems as if the method getColumnViewHtml takes 3 parameters and not one.
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.