Details
-
Bug
-
Status: Done
-
High
-
Resolution: Fixed
-
5.0.14
-
None
-
JIRA Software: Version 7.4.1
ScriptRunner: Version 5.0.14
-
Sprint 37 - Ends Nov 28
-
1.7
Description
I have experienced an issue related to, but in stark contrast to SRJIRA-2333 in which there are issues manipulating the Issue Links form field with behaviours.
Notably, the bug that I experience is that I am able to set the Issue Links field as required with formField.setRequired(true) (showing the red asterisk), but when I set it to "not required" via the same method with a value of false, the red asterisk does not disappear.
I've noticed that upon setting the Issue Links field to required, this exception is thrown in the Chrome console:
batch.js?agile_global_admin_condition=true&healthcheck-resources=true&is-server-instance=true&is-sy…:7722 Uncaught TypeError: Cannot read property 'fieldType' of undefined at HTMLLabelElement.validateRequiredField (batch.js?agile_global_admin_condition=true&healthcheck-resources=true&is-server-instance=true&is-sy…:7722) at HTMLLabelElement.dispatch (batch.js?locale=en-US:104) at HTMLLabelElement.h (batch.js?locale=en-US:96) at Object.trigger (batch.js?locale=en-US:101) at HTMLLabelElement.<anonymous> (batch.js?locale=en-US:117) at Function.each (batch.js?locale=en-US:54) at init.each (batch.js?locale=en-US:47) at init.trigger (batch.js?locale=en-US:117) at addFieldListeners (batch.js?agile_global_admin_condition=true&healthcheck-resources=true&is-server-instance=true&is-sy…:7722) at Object.<anonymous> (batch.js?agile_global_admin_condition=true&healthcheck-resources=true&is-server-instance=true&is-sy…:7723)
The same exception specified in SRJIRA-2333.
To test this, create a behaviour on the Resolution field and use a serverside script similar to:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.config.ResolutionManager def resolutionManager = ComponentAccessor.getComponent(ResolutionManager) def resolution = getFieldById(getFieldChanged()) log.warn("Resolution Value: "+resolution.value.id) def currentResolution = resolutionManager.getResolution(resolution.value.id as String).name def linkedIssue = getFieldById("issuelinks") if(currentResolution == "Done") { resolution.setRequired(true) linkedIssue.setRequired(false) } else if(currentResolution == "Won't Do") { resolution.setRequired(false) linkedIssue.setRequired(true) } else { resolution.setRequired(true) linkedIssue.setRequired(false) }
Using log statements, I've found that the Linked Issues field is actually being set to "required" and "not required" properly. But when the exception is thrown in the console, you are unable to continue with submitting the form and the red asterisks are not removed.
Attachments
Issue Links
- duplicates
-
SRJIRA-2403 The Linked Issues field cannot be set back to optional after making it required
-
- Done
-
- is duplicated by
-
SRJIRA-2333 Setting linked issues field as required in behaviours does not mark the field as required
-
- Done
-
- is related to
-
SRJIRA-2355 Behaviour on Component/s field result in an Uncaught TypeError when set to required and the project has no components
-
- Done
-
- relates to
-
SRJIRA-2333 Setting linked issues field as required in behaviours does not mark the field as required
-
- Done
-
-
SRJIRA-2452 On transition screens fix version/s red asterisk persists when set to not required via Behaviour
-
- Done
-