Hello,
I am aware of the subcomponents plug in. What I'm looking for is two fields next to each other. The field on the left would be a category, and based on that selection, the component field would then have its options limited to a subset.
Basically I want a way to make my components two tiered, but nothing more. The Subcomponent plug in is a bit too complex for what I want to do. I don't need folders or things like that and I don't want the field itself to have so much complexity. I just want to give my users one field to select from a few categories, then once that is selected, they can then choose a relevant component.
Take a look at:
import com.onresolve.jira.groovy.user.FieldBehaviours
import static com.atlassian.jira.issue.IssueFieldConstants.*
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.project.component.*
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def projectComponentManager = ComponentAccessor.getProjectComponentManager()
def components = projectComponentManager.findAllForProject(issueContext.projectObject.id)
def cfManager = ComponentAccessor.customFieldManager
def optionsManager = ComponentAccessor.optionsManager
final singleSelectName = 'System'
def formSingleSelect = getFieldByName(singleSelectName)
def singleSelectValue = formSingleSelect?.value
getFieldById(COMPONENTS).setFieldOptions(components.findAll { it.getName()?.contains(singleSelectValue.toString()) })
-----------------------
The above behavior (set to listen on the custom field "System") will limit the available components to the ones, where the name matches the value of the selected Systems.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Very nice! I'll see if we can try to implement this. We just started using ScriptRunner. Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Taylor Johnson,
Welcome to the Atlassian Community.
Have you considered using the Select List (cascading) custom field instead of component?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I want to maintain the benefits component gives me like having component lead assigned and the component based dashboard gadgets.
I've seen this done at my old company, I just don't know how.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.