Affects Version/s: 126.96.36.199-jira8
Fix Version/s: 6.25.0
Sprint:SR4J Sprint 80, SR4J Sprint 81, SR4J Sprint 82, SR4J Sprint 83, SR4J Sprint 84, SR4J Sprint 85, SR4J Sprint 86, SR4J Sprint 87, SR4J Sprint 88, SR4J Sprint 89, SR4J Sprint 92, SR4J Sprint 93, SR4J Sprint 94, SR4J Sprint 95, SR4J Sprint 96, SR4J Sprint 97
When opening the create/edit form, the event for user interaction on forms fields gets triggered even if the user has not selected that field with for example mouse input and therefore the server-side script is triggered without the user interacting with the field.
This means that the initialiser and the field level server side script would trigger as soon as the create/edit window is opened rather than just the initialiser.
User is attempting to set the assignee field to the logged in user in the initialiser for create screens, and in the server side script is making sure that if the user chooses "automatic" (i.e. -1) then an error is set on the field.
You will end up with the assignee field being changed to the value from the initialiser but at the same time an error is set on the assignee field because both scripts are triggered when the create form loads, and the value for the assignee field is -1 until the user has manually changed from interacting through the UI.
When we set the assignee field in the initialiser, it does not register as changed when the field server side script runs and therefore the field script reads the value -1
Steps to reproduce:
- Set a basic behaviour in the initialiser that logs when it is triggered and sets the assignee to the logged in user.
- Set a basic behaviour on the assignee field as server-side script that logs when triggered and sets an error if the assignee field value is -1 or null.
- Save and map to your project.
- Open the create/edit window and you should see in the logs that the assignee field script runs without any interaction with it and sets an error on the assignee field (edit: for a split second, then it gets removed)
Also it behaves differently for like description field.
1. Set a basic behaviour in the initialiser that logs when it is triggered and sets the description field any value
2. Set a basic behaviour on the description field as server-side script that logs when triggered and sets an error if the description field value is -1 or null.
3. Save and map to your project.
4. Open the create/edit window and you should see in the logs that the description field script runs without any interaction with it and sets an error on the description field (error message doesn't disappear like in assignee example)