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

Inconsistent setError in Behaviours

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 4.3.19
    • Fix Version/s: 5.3.0
    • Component/s: Behaviours
    • Labels:
      None
    • Critical Points:
      0.8

      Description

      Steps to reproduce

      • Attach a behaviour to a select list (SelectListA), that will make a text field (TextFieldA) required when value of SelectList equals to AAA
      • For the serverside script use
      def fieldA = getFieldByName("TextFieldA")
      def selectListA = getFieldById(getFieldChanged())
      
      if (selectListA.getValue() == "AAA") {
          fieldA.setRequired(true)
      }
      else {
          fieldA.setRequired(false)
      }
      
      • Select the AAA value and try to submit the issue, you will get an error You must enter a value for this field
      • Select the BBB value, try to submit, the error message is still there despite the fact that the TextFieldA is not required any more, and you cannot submit the issue.

      What is happening is that the asterisk is not there for the TextFieldA (correct) but if there is an error message from before, is not getting cleared and that prevents the submit.

      Workaround

      Clear the error from the script

      def fieldA = getFieldByName("TextFieldA")
      def selectListA = getFieldById(getFieldChanged())
      
      if (selectListA.getValue() == "AAA") {
          fieldA.setRequired(true)
      }
      else {
          fieldA.setRequired(false)
          fieldA.clearError()
      }
      

        Attachments

          Activity

            People

            Assignee:
            jechlin Jamie Echlin
            Reporter:
            tbatagiannis Thanos Batagiannis
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: