Show/Hide Custom Fields depend on another custom Field Value


I have three custom fields (A, B, C). I want to display on the form/initialize fields B and C only when field A has a value. Field A is a Select List (single choice). I have the Scriptrunner plugin so i can use either behavior plugin or scripted fields. I found many solutions in the community with similar codes but none of them is working properly for my project. 

Where do i have to put the code and what code shall i use to make the fields B and C hidden from the beginning (before creating the issue)?

1 answer

This widget could not be displayed.

Hi Stefani,

You should be able to do this fairly easily using a behaviour.

  1. Create a new behaviour added to Custom Field A
  2. Add a server side script
  3. Use this code (remember to put in the names of your fields for Field B and Field C)
def SelectListA = getFieldById(getFieldChanged()) // Field A

def TextFieldA = getFieldByName("TextFieldA") // Field B

def TextFieldB = getFieldByName("TextFieldB") // Field C

if (SelectListA.getValue()) {

This script will hide Field B and Field C whenever someone tries to create an issue. If they select a value for Field A, both fields will become visible.

Fields hidden from the beginning:

Screen Shot 2017-08-24 at 11.42.22 AM.pngFields shown after SelectListA has a value:

Screen Shot 2017-08-24 at 11.42.32 AM.png

I've tried it but it doesn't work, Am i missing something? I want to hide automatically these fields on the form. I am working on a Service Desk issue's form. When a user clicks on the 'Report a problem', the form that is shown has to have the fields B and C hidden and display them only when the user choose any value from the field A. Do i have to enable Initialiser Function or Validator Plugin?

Behaviours do not work well with JIRA Service Desk, unfortunately.They are not compatible with each other.

Hi Joshua,

This works

Qi Jiang what does exactly work? Is there any other way/solution for this to be done in Service Desk?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

146 views 2 0
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