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

Error calling getCustomFieldValue() on scripted fields

    Details

    • Type: Bug
    • Status: To Do (View Workflow)
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 5.5.9, 5.5.9.1-jira8
    • Fix Version/s: None
    • Component/s: Scripted Fields
    • Labels:
      None
    • Critical Points:
      0.6

      Description

      getCustomFieldValue() stopped working on the scripted field after move issue.

      Steps to reproduce

      1. Create a new scripted field with the code:
        return "value"
        
      2. Create a project with issue types A and B. Add the scripted field to the view screen for issue type B.
      3. Create an issue of issue type A. Move the issue to issue type B. You will see the scripted field value on the screen.
      4. Run the code in Script Console
        import com.atlassian.jira.component.ComponentAccessor
        def issueManager = ComponentAccessor.getIssueManager()
        def issue = issueManager.getIssueObject("AA-9") //issuekey
        
        def customFieldA = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Text Field")
        def customFieldB = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Select list")
        def customFieldC = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Scripted Field")
        
        log.error("customField A: "+issue.getCustomFieldValue(customFieldA))
        log.error("customField B: "+issue.getCustomFieldValue(customFieldB))
        log.error("customField C: "+issue.getCustomFieldValue(customFieldC))
        log.error("customField A: "+issue.getCustomFieldValue(customFieldA))
        
        log.error("Done")
        

        Results:

        2019-08-15 04:04:24,380 ERROR [runner.AbstractScriptRunner]: customField A: null
        2019-08-15 04:04:24,382 ERROR [runner.AbstractScriptRunner]: customField B: null
        
      5. Stop at line 2.

      Expected Results

      It should return a null or value and not blocking the rest of the code.

      ERROR [runner.AbstractScriptRunner]: customField A: null
      ERROR [runner.AbstractScriptRunner]: customField B: null
      ERROR [runner.AbstractScriptRunner]: customField C: Value
      ERROR [runner.AbstractScriptRunner]: customField A: null
      

        Attachments

          Structure

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              jloong John Chin Loong
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Structure Helper Panel