Details
-
Bug
-
Status: Done
-
High
-
Resolution: Done
-
5.8.0-p5
-
None
-
None
-
SR4J Sprint 78
-
0.8
Description
It's possible to set up an infinite loop, but using two selects, each that set the value of the other (to eg None).
This only happens with select2 fields, for example, standard single selects (but only using the service desk view), or possibly say fixVersions and components system fields.
To reproduce in Service Desk.
Add two single select list fields, it doesn't matter what options they have.
Add this behaviour on the first:
def fieldA = getFieldByName('SelectListA') if (!fieldA.value) { def fieldB = getFieldByName('SelectListB') // if (fieldB.value) { fieldB.setFormValue("None") // } }
Add a similar behaviour on the second, with the fields inverted. The idea is setting either to None will set the other to None.
This will cause each field to continually set the value of the other.
The problem happens because with select2 fields we have to clear out the options then add them back, so an event is fired on the field even though it has not changed.
Workaround
Only set the field to None if it's not already None. This can be done by uncommenting the lines in the example above.