JIRA Behaviours - how to use setFieldOptions for cascading select field?

I'm trying to set up functionality similar to https://jamieechlin.atlassian.net/wiki/display/JBHV/Miscellaneous+Behaviours+Examples#MiscellaneousBehavioursExamples-Addorremoveoptionstosingleormulti-selectfields but instead of a single or multi select field, I'm trying to do so with a cascading select field. The below code will populate the first dropdown of a cascading select field, but none of the values from the second dropdown show up. Does anyone have any information on how the data needs to be formatted in order to get the setFieldOptions method to work for both dropdowns in a cascading select field?

 

FormField functionalArea = getFieldByName("Functional Area")
def ops = ["-1":"None"]
ops.put("50632","508 Compliance Testing")
ops.put("50620","Activity Tracking")
functionalArea.setFieldOptions(ops)

3 answers

1 accepted

Accepted Answer
0 votes

I don't remember if cascading selects are properly supported or not, but your example code is what you'd use for setting a single select. For cascading selects the values should themselves be option ID->value maps.

I was thinking about that too. But doing this seems to not adjust the values seen on the screen at all. No errors in the log either. Then I started thinking again, wouldn't the second value in the map need to be a list of maps in order to handle multiple values in the second dropdown? I implemented the below map to setFormValues() with, and again, it doesn't appear to adjust the values either with no errors in the log. I enabled debugging and it returns a map. def ops = [:] ops.put(["-1":"None"],["-1":"None"]) ops.put(["50632":"508 Compliance Testing"],["-1":"None"]) ops.put(["50620":"Activity Tracking"],[["-1","None"],["50621":"To Do List"],["50628":"Work Activity Log"]]) /rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/runvalidator.json [onresolve.jira.groovy.BehaviourManagerImpl] Returning map: [customfield_10081:[fieldOptions:[[-1:None]:[-1:None], [50632:508 Compliance Testing]:[-1:None], [50620:Activity Tracking]:[[-1, None], [50621:To Do List], [50628:Work Activity Log]]], fieldType:com.atlassian.jira.plugin.system.customfieldtypes:cascadingselect, displayName:Functional Area]] Is there any way you could determine if cascading selects are properly supported? I'm starting to get the feeling they aren't based on my inability get it to work with all the different data types I've tried to put in here.

I do not have a functional test for cascading selects, which I'm afraid suggests to me that they are not implemented. There is also https://jamieechlin.atlassian.net/browse/JBHV-202.

Alright. I think I'll just mark this as an accepted answer because functionality not implemented is what it is. I'm sure if you do implement it in the future, you will put it in the release notes for the plugin. Thanks for looking into this and thanks for making a great plugin for JIRA.

thanks for your understanding.

Adam Yerkman - did you find any alternative to do this?

I haven't found an alternative yet. I told the group that requested it from me that it wasn't possible to my knowledge, and I will investigate any solutions that might implement this functionality.

I did a work-around. I use two select list that act as this cascading select list. Probably u can do that :)

Hi @Adam Yerkman, have you found a solution for this?

Thank you in advance

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

34 views 0 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you