Show text field based on selection in list Edited

Dear All,


I am a first time user of Jira Software and am currently trying to set up an issue with several fields, with some only being shown based on the value a user previously selects. 

To implement this, I am using the ScriptRunner add-on. When trying to add a behaviour to a text field to make it appear only if a user selects a certain value from a list, i.e. a custom field, nothing happens. 

Here is my code:

def reqValF= getFieldById('customfield_10501')
def depTxtF = getFieldById('customfield_10503')

def reqValF_val = reqValF.getValue()

if (reqValF_val == "New"){


Thank you! 

1 answer

1 vote


I think you were pretty close. You need to specify 'as String' in order to compard the value of the field to a string. 

def reqValF= getFieldById(getFieldChanged())
def depTxtF = getFieldById('customfield_10503')

def reqValF_val = reqValF.getValue() as String

if (reqValF_val != "New"){

 I have not tested this directly, but it should work. Let me know if you have any problems. :)



Hello Jenna,


thank you for your reply! Unfortunately it doesn't work. Is it ok to add the script to the 'edit server side script'-section of my custom field or do I need to import something? I have not set up a dev environment as I am currently on a tight schedule.



Hi Christina,

Yes, putting the script in the server side script seciton is fine. I have tested Jenna's code and it does work. However, I think you may just have the behaviour on the wrong field. The behaviour should be on the Select List (reqValF). The behaviour should not be on the text field that you want to hide.

Hi Joshua, unfortunately I could not figure out where the problem lies. I switched to JJupin now. Here it works.


Thanks again!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Sarah Schuster
Posted Mar 28, 2018 in Jira Software

Can a company’s culture make or break agile adoption?

Can a new-to-agile team survive and thrive in a non-agile culture? If so, what advice would you give to those trying to be agile in a non-agile culture? What's the key(s) to success? Share your thoug...

12,071 views 15 13
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