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

Behaviours read-only doesn't work correctly for Multiple Insight Object/s field when using setFormValue() to set the Multiple Insight Object/s field in Initialiser

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Done
    • Low
    • Resolution: Done
    • 6.42.0
    • 6.53.0, 7.0.0
    • Behaviours
    • None
    • SR4J Sprint 124 (6.52), SR4J Sprint 128 (6.57), SR4J Sprint 129 (6.58), SR4J Sprint 130 (7.00)
    • 2.2

    Description

      Summary

      Set the Multiple Insight Object/s field read-only using Behaviours doesn't work correctly when populating its values using the setFormValue() in the Initialiser.

      Steps to Reproduce

      Prerequisites
      • Install Insight - Asset Management
      • Create an Object Schema
      • Create some objects in the created Object Schema

      1. Create an Insight Object/s field, configure this field as multiple and select the created schema.
      2. Associate the Multiple Insight Object/s field with the projects, e.g. SUN project.
      3. Create a Behaviour, add mapping to the SUN project and all issue types.
      4. Attach the following snippet to the Behaviour Initialiser:

      //Change the "Insight Objects" to your Multiple Insight Object/s field name and "["HOS-1", "HOS-3"]" to the object keys
      getFieldByName("Insight Objects").setFormValue(["HOS-1", "HOS-3"])
      

      5. Add the Multiple Insight Object/s field in the Behaviour, set the field read-only.

      7. Navigate to the SUN project, then create/edit an issue.

      Expected Behaviour

      Default values are set into the field. Users are not able to select or remove the objects from the field. 

      Actual Behaviour

      Default values are set into the field. Users are not able to select objects from the field, but they can remove the object by clicking the "cross" button. 

      Additional Info

      • Tested on Jira 8.15.0, ScriptRunner 6.42.0 and 6.48.0 (latest version).
      • This issue occurs only on Insight Object/s (Multiple).
      • Set the field read-only using the setReadOnly method gives the same problem too:
        getFieldByName("Insight Objects").setReadOnly(true)

       

      Attachments

        Issue Links

          Activity

            People

              msaqib Muhammad Saqib
              jpang JJ Pang
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: