Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Done
-
None
-
None
Description
Description
Xporter not working when there are Jira custom fields defined on the view colored by the Scriptrunner
Pre-conditions
Install ScriptRunner
Apply the following script to color the custom field (change the project and the custom field)
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_11300" 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)) if (value == "A"){ writer.write("<script>var css = '#customfield_11300-val { background-color: yellow; color: yellow; font-weight: bold; border-bottom: 2px solid yellow; }', head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style');head.appendChild(style);style.appendChild(document.createTextNode(css));</script>") } else if (value == "V"){ writer.write("<script>var css = '#customfield_11300-val { background-color: red; color: red; font-weight: bold; border-bottom: 2px solid red; }', head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style');head.appendChild(style);style.appendChild(document.createTextNode(css));</script>") }
How to reproduce
- Create a Jira Custom field with single select option
- Use the above script on the configuration of the ScriptRunner and the rest of the following data:
- Go to the Issue where the field is visible
- Try to use Xporter with any template
Actual result/Attachments
Expected result
Document was generated
Version
- 6.9.6