It’s very easy to do in Jira Server with the help of the awesome plugin Adaptavist Scriptrunner.
Just create a new Behaviour ( press “.” and write Behaviours).
Associate the Behaviour to your project (and/or issuetype/s).
And the click in “Fields” to add the field you want to “observe”. For example, custom field “Jira Category“.
We will hide/show a field called “Jira Project affected” and we will set as mandatory when “Jira Category” field matches some value (for example will be hide when the value is set to “Confluence Permission Problem“)..
Field to hide (and set as optional and not mandatory)
We need to place a code like this in the Behaviour.
def browserField = getFieldByName("Jira Project affected") def categoryField = getFieldById(getFieldChanged()) browserField.setRequired(true) def patternAppConfluence = "Confluence Permission Problem" def selectedOption = categoryField.getValue() as String def matcher = selectedOption =~ patternAppConfluence def isConfluenceApp = matcher.matches() browserField.setHidden(isConfluenceApp) browserField.setRequired(!isConfluenceApp)