Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-1234

Can't figure out how to get/set cascading fields with Groovy

    XMLWordPrintableJSON

    Details

    • Type: Change
    • Status: Done
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.7
    • Fix Version/s: None
    • Component/s: None
    • Environment:

      Standalone, Solaris

    • Critical Points:
      0

      Description

      Jamie,

      I'm tring to use your excellent Script Runner to do a Post Function after an issue is created. I'm able to get access to both included and custom fields but when I try to grab the value from a custom cascading field (called System/Application Supported) I get this back:

      CustomFieldParams: System/Application Supported. Params:

      {null=[Sales], 1=[Group A]}

      .

      The code I'm using is this:

      import com.atlassian.jira.ComponentManager
      import com.atlassian.jira.issue.CustomFieldManager
      import com.atlassian.jira.issue.fields.CustomField
      import org.apache.log4j.Category

      ComponentManager componentManager = ComponentManager.getInstance()
      CustomFieldManager cfManager = ComponentManager.getInstance().getCustomFieldManager()

      CustomField cfSysAppSup = cfManager.getCustomFieldObjectByName("System/Application Supported")

      Object cfSysAppSupValue = issue.getCustomFieldValue(cfSysAppSup)

      String environment

      environment = cfSysAppSupValue

      issue.setEnvironment(environment)
      issue.store()

      I don't know how to use the data that comes back to split out the System vs. Application Supported fields. I'm not a heavy Java programmer so this may be a simple issue. I appreciate you help.

        Attachments

          Activity

            People

            Assignee:
            jechlin Jamie Echlin
            Reporter:
            mdeje@sunlife.com Michael de Jeu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: