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

Service Desk mapped Behaviour's setFormValue() doesn't work after setFieldOptions()

    Details

    • Type: Bug
    • Status: Done
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: 6.21.0
    • Fix Version/s: 6.24.0
    • Component/s: None
    • Labels:
    • Sprint:
      SR4J Sprint 96
    • Critical Points:
      0.5

      Description

      setFormValue() fails on a single select list when setFieldOptions() are used too.

      Steps to Reproduce
      1. Create a single select list custom field with options A, B, C, D and E, for a JSM project.
      2. Create a Behaviour mapped to the project Service Desk customer portal.
      3. Filter the options to only A, B and set default option to "B". Attach following script to the custom field:

      import com.atlassian.jira.component.ComponentAccessor
      
      def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(getFieldChanged())
      def config = customField.getRelevantConfig(getIssueContext())
      def availableOptions = ComponentAccessor.getOptionsManager().getOptions(config)
      def defaultOption = availableOptions.find {it.value == 'B'}
      
      def formField = getFieldById(getFieldChanged())
      formField.setFormValue(defaultOption.optionId)
      formField.setFieldOptions(availableOptions.findAll {it.value in ['A', 'B']})
      

      Epected Behaviour
      When create a request through customer portal, the custom field options are filtered and a default option 'B' is selected.

      Actual Behaviour
      The custom field options are filtered, but option 'B' is not selected.

      Workaround
      No workaround.

      Screen Recording
      setFormValue() fails after setFieldOptions().mov

        Attachments

          Activity

            People

            Assignee:
            jechlin Jamie Echlin
            Reporter:
            mlim Max Lim
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: