Uploaded image for project: 'Xporter for Jira'
  1. Xporter for Jira
  2. XPORTER-3964

Xporter not working when ScriptRunner color Jira Custom fields

    XporterXMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Done
    • None
    • 6.9.9
    • App Integration, Exporting
    • None
    • OK

    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

      1. Create a Jira Custom field with single select option
      2. Use the above script on the configuration of the ScriptRunner and the rest of the following data:


      3. Go to the Issue where the field is visible
      4. Try to use Xporter with any template

      Actual result/Attachments

      Expected result

      Document was generated

      Version

      • 6.9.6

      Attachments

        Activity

          People

            afro Andre Fernandes Rodrigues
            lpss Luis Sousa
            Votes:
            5 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: