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 vote
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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

124 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