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

Behaviour on Component/s field result in an Uncaught TypeError when set to required and the project has no components

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 5.0.14
    • Fix Version/s: 5.3.0
    • Component/s: Behaviours
    • Labels:
      None
    • Environment:

      JIRA Software | 7.4.2

      ScriptRunner | 5.0.14

    • Sprint:
      Sprint 37 - Ends Nov 28
    • Critical Points:
      0.7

      Description

      If I a behavior attempts to perform setRequired(true) on the component field but the actual control is not visible because no component values exist in the project, an uncaught TypeError can be seen in the dev console and the behavior is not applied and other actions in the script are also not applied.

      The browser error is as follows:

      batch.js?agile_global_admin_condition=true&healthcheck-resources=true&is-server-instance=true&is-sy…:7378 Uncaught TypeError: Cannot read property 'fieldType' of undefined
          at HTMLLabelElement.validateRequiredField (batch.js?agile_global_admin_condition=true&healthcheck-resources=true&is-server-instance=true&is-sy…:7378)
          at HTMLLabelElement.dispatch (batch.js?locale=en-US:104)
          at HTMLLabelElement.h (batch.js?locale=en-US:96)
          at Object.trigger (batch.js?locale=en-US:101)
          at HTMLLabelElement.<anonymous> (batch.js?locale=en-US:117)
          at Function.each (batch.js?locale=en-US:54)
          at init.each (batch.js?locale=en-US:47)
          at init.trigger (batch.js?locale=en-US:117)
          at addFieldListeners (batch.js?agile_global_admin_condition=true&healthcheck-resources=true&is-server-instance=true&is-sy…:7378)
          at Object.success (batch.js?agile_global_admin_condition=true&healthcheck-resources=true&is-server-instance=true&is-sy…:7379)

       

      To reproduce this issue:

      • Create a project without any component 
      • Create a new behavior with a server side script (initializer) and adequate mapping 
        def comp = getFieldById("components") 
        comp.setHelpText("Test message about the component/s field") 
        comp.setRequired(true) 
      • Create a ticket for that project (ensuring the create screen displays the component field) 
      • Result:
        • Browser console error 
        • help text is not visible 
      • Change the "comp.setRequired(true)" to "comp.setRequired(false)" and see that the help text is displayed and no console error appear.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jechlin Jamie Echlin
              Reporter:
              aderossett Aidan Derossett
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: