Hello There,
I would like to use a multi-level cascading select lists with ScriptRunner.
There's the custom field type "Select List (cascading)" only supports 2 levels, and I want to 3 levels (and maybe more). I search in community that there is an add-on "Multi-Level Cascading Select" can full fill this, but is non-free. Does anyone try with ScriptRunner?
Have a look through https://library.adaptavist.com/search?page=1&products=jira&term=select - there are loads of scripts there that could help you make fields interdependent.
Hi @jessiexjqin ,
Did you find or create a script for the multi-level (more than the standard 2) cascade?
Thanks,
James
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.
Hi @chinmay borkar ,
I managed to work out a custom script in the end which I set up as a behavior.
You need an initialiser first (replace the bits in bold) -
import com.atlassian.jira.component.ComponentAccessor
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField1 = getFieldByName('******Field name 1******')
def customField1Value = customField1.getValue()
def customField2 = getFieldByName('******Field name 2******')
def CustomField2CF = customFieldManager.getCustomFieldObjectsByName("******Field name 2******")[0]
def config = CustomField2CF.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
switch(customField1Value){
case '****Field 1 drop down value A****':
def newOptions = options.findAll { it.value in ["***Field 2 drop down value A***", "***Field 2 drop down value B***", "***Field 2 drop down value C***"] }
customField2.setFieldOptions(newOptions)
break;
case '****Field 1 drop down value B****':
def newOptions = options.findAll { it.value in ["***Field 2 drop down value D***", "***Field 2 drop down value E***"] }
customField2.setFieldOptions(newOptions)
break;
case '****Field 1 drop down value C****':
def newOptions = options.findAll { it.value in ["***Field 2 drop down value F***", "***Field 2 drop down value G***"] }
customField2.setFieldOptions(newOptions)
break;
}
Then you add the serverside scripts with the Field 1 script the same as above and then the subsequent field scripts updated reference the relevant data sets is -
Field 1 Server-side script covers Fields 1 + Field 2
Field 2 Server-side script covers Fields 2 + Field 3
Field 3 Server-side script covers Fields 2 + Field 4
and so on....
Hope that helps...
James
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.