Change Options in drop down based on another field value using behaviors

Keshavan Babu May 12, 2017

Hi Support,

we are using script runner and are trying to implement certain features using behaviours.

one such scenario is that based on the value in one dropdon controlling the values displayed in the second one. Literally a cascading dropdown effect is what we are looking at.

I searched quite a bit and was unable to find any decent article on how this can be acheived , is there a way to get this done?

Regards,

Shankar

 

1 answer

0 votes
Mirek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 31, 2022

I think that this article might be helpful

https://www.idalko.com/use-behaviour-functionality-script-runner-show-hide-fields/

There is a sample code that looks like this

def dropDown = getFieldById("customfield_10500")
def conditionA = getFieldById("customfield_10501")
def conditionB = getFieldById("customfield_10502")
log.debug("dropdown value" + dropDown.getValue())
 
if (dropDown.getValue() == "a") {
    conditionA.setHidden(false);
    conditionB.setHidden(true);
} else {
    conditionA.setHidden(true);
    conditionB.setHidden(false);
     
}

Also similar question here 

https://community.atlassian.com/t5/Adaptavist-questions/Scriptrunner-Behaviour-show-a-field-when-value-is-selected-in/qaq-p/1869832

Suggest an answer

Log in or Sign up to answer