How do I display a field based on the values of a Single select list in JIRA?

Hello, I am have been trying to display a field based on the value of a single select list using the example mentioned in the page below, but it doesnt work.

I read that it can be achieved using Behaviors in ScriptRunner?

Can I get some more information on how this could be done?

2 answers

0 votes
Steven Behnke Community Champion Apr 01, 2016

I wrote my own updated version of that script, I can provide it – 

<script type="text/javascript">
   Use Case
   Only show targetField when the changingField is set to
   This is using basic javascript and the jquery library
   provided by atlassian. This should be within the Field
   Description, within the Field Configuration.
   The jQuery can be accessed using the AJS.$ wrapper.*/
    //Obtain the first field by ID
    changingField = document.getElementById('customfield_13322');
    //Start our process if the field is present
    if (changingField) {
            //Desired value to show the target field
            desiredValue = '10939'
            //Obtain the second field by ID
            targetField = document.getElementById('customfield_13708');
            // This first if-statement will hide the target field immediately, unless the default value is set to our desired value
            // Hide the target field's container if changing field isn't set the desired value
            if (changingField.value != desiredValue) AJS.$(targetField).parent().hide()
            // onchange runs when a select field changes. Basic logic here shows it for desired value, hides it for all else
            // Be sure to set the field to nothing when using the else clause to hide the field container, otherwise you'll still submit data
            changingField.onchange=function() {
                if (this.value == desiredValue) {           
                    AJS.$(targetField).parent().fadeIn( 200, "jswing" )
                    } else {
                        AJS.$(targetField).parent().fadeOut( 200, "jswing" )
Steven Behnke Community Champion Apr 01, 2016

Unfortunately I haven't done this specific task with ScriptRunner Field Behaviors – You can look for hints or examples on the documentation page:

Can you please advise how this can be done using a Cascading Select. I am not too familiar with java script. Might need to get sometime to learn more about JS.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,088 views 4 9
Read article

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