Would anyone mind to give some suggestions on how to make a dependent select list?
Or if there is any work around without use plugins.
I mean if there is 3 list: A,B and C. The options of B depend on what we choose in list A.
The cascading list only allows two select list.
Can I use two cascading A B and B C to make the relationship between A,B and C?
Thanks
I know you said no plugins, but...
If you're on Jira Server or Data Center, you can do this with the Behaviours module of ScriptRunner. If that's an option for you, I suggest looking into that.
An option in default Jira would be to use a single-select list with all of the possible A, B, and C combinations as single values in this field, but if you have a lot of values/combinations, it might get pretty messy or you might have A LOT of values in the field.
Hi Alex,
Thanks for your reply!
I tried the Behaviours module but it cannot dynamic change the options in a select list from A,B,C to D,E,F.
I can only select a value for select list based on other custom field value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe it's possible to set the options available in a select list field using the Behaviors add-on. In the quick reference guide, there is a method for doing this:
Method
formField.setFieldOptions(Iterable)
Example
formField.setFormValue(options.findAll {it.value in ['foo', 'bar']})
Here's a quick example that might cover your requirements.
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def fieldA = getFieldByName("Field A").getValue()
def fieldB = getFieldByName("Field B").getValue()
def fieldBObject = customFieldManager.getCustomFieldObjectByName("Field B")
def fieldBConfig = fieldBObject.getRelevantConfig(issue)
def fieldBOptions = optionsManager.getOptions(fieldBConfig)
if (fieldA.equals("Some value")) {
fieldB.setFieldOptions(fieldBOptions.findAll {it.value in ['value a', 'value b']})
}
else if (fieldA.equals("Some OTHER value") {
fieldB.setFieldOptions(fieldBOptions.findAll {it.value in ['value c', 'value d']})
}
I haven't done any troubleshooting on this, so the code might need a little work. You would need to add another script to the same Behaviour based on what is chosen for Field B to also update the options available for Field C.
Hope this helps or at least points you in the right direction!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.