Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Trying to get a field to be hidden or not hidden depending on the selection of a Multi Select List

**Already asked this question for a Single Select List, that I got to work, but found out we can't change it to a single select and need to make it work for a Multi Select List**

We are trying to make it where a field is hidden on a screen unless one of the two highlighted choices are picked:


Here is the code that I got to work for the Single Select List in the behaviour Is there anything I can do to make it work for the Multi Select List?:

def apc = getFieldByName("Analysis Provided to Client")
def severity = getFieldById(getFieldChanged())

def selectedOption = severity.getValue() as String

if (severity.getValue() == "No Impact/Task") {
}else if(severity.getValue() == "4 - Affects non-critical function (low impact)") {
} else if(severity.getValue() == "3 - Affects non-critical function (high impact)") {
}else if(severity.getValue() == "N/A"){
}else {
apc.setHidden (false)

1 answer

1 accepted

0 votes
Answer accepted

What I like to do in this case is do something like this:

severity.setHelpText("$severity.value (${severity.value.getClass()})

This way, you'll see what you're working with based on what you select in your severity. I think you'll see an ArrayList of String values.

Then, you can simplify your code quite a bit.

Try this:

def apcVisibleWhenSeverities = [
'1 - Affects critical function (low impact)',
'2 - Affects critical function (high impact)'
def severityFld = getFieldById(fieldChanged)
def apcFld = getFieldByName("Analysis Provided to Client")
apcFld.setHidden(!severityFld.value.any{it in apcVisibleWhenSeverities})


Am I supposed to put the first line code in the behaviour with the other code? I tried the code and it did not work for me unfortunately


I am new to the whole behaviour piece of Jira and I am hoping that I didn't miss anything or set it up work.


Here is what I meant with that first lines... just to use some debug information

2021-12-17 09_34_44-Edit Behaviour_ test.png2021-12-17 09_36_15-Create Issue - JIRA Dev.png

This gives me some information about what type of data we get from fld.value.

Then when I convert the script I gave you to work with my situation and fieldnames,

2021-12-17 09_50_31-Edit Behaviour_ test.png

I'm able to show/hide my sprint field accordingly

Shown because I selected "products"

2021-12-17 09_52_56-Create Issue - JIRA Dev.png

Hidden because products or mobile are not selected:

2021-12-17 09_52_21-Create Issue - JIRA Dev.png

What you have should work. Just make sure the spelling of those severities and field names are correctly matched in the code.

Like Justin Mele likes this

Quick question do I want this behviour on the Multi Select List Field or the Analysis Provided to Client Field? 

Got it to work! It was a simple wording issue that fixed it.

Behaviours on a specific field are executed whenever that field is modified. So you'll want this behaviour code on the Severity field so it fires when you change the severity.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

79 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you