Hello community,
I want to display an existing custom field in a web panel. I use the “Show a web panel” function from ScriptRunners Script Fragments.
In my case it’s a calculated progress field from the sumUp plugin.
This is what I want:

This is what I get:

I have found an old post in which it says that it’s not possible to display custom fields in a web panel. Maybe that has changed in the meantime.
Maybe (or most likely) there is a bug in my script because I don't know Groovy that well.
This is the script I use:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.RendererManager
def issue = context.issue as Issue
String customfield = "customfield_19800"
def rendererManager = ComponentAccessor.getComponent(RendererManager)
def fieldLayoutItem = ComponentAccessor.getFieldLayoutManager().getFieldLayout(issue).getFieldLayoutItem(customfield)
def renderer = rendererManager.getRendererForField(fieldLayoutItem)
String value = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject(customfield))
writer.write(renderer.render(value, issue.getIssueRenderContext()))
Best regards,
Jo