We have projects that have multiple Components and others that only have 1. The Component/s field is required in all projects because they all share the same Field Configuration.
When creating a new issue in a project that only has 1 Component and the user does not click on that one Component, an error is received stating that the field is required. That's pretty silly. Is there an easy way to prevent that? (easier than writing a Behaviour script with ScriptRunner I mean).
This is on Jira Server 8.5.1
Ok, there's four "solutions" to this.
I decided to go with option #4, to avoid having to create additional configurations:
import com.atlassian.jira.component.ComponentAccessor
def componentField = getFieldById("components")
def projectComponentManager = ComponentAccessor.getProjectComponentManager()
def components = projectComponentManager.findAllForProject(issueContext.projectObject.id)
componentField.setFormValue(components[0].id)
componentField.setHidden(true)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.