Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,482
Community Members
 
Community Events
185
Community Groups

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:

image.png

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") {
apc.setHidden(true)
}else if(severity.getValue() == "4 - Affects non-critical function (low impact)") {
apc.setHidden(true)
} else if(severity.getValue() == "3 - Affects non-critical function (high impact)") {
apc.setHidden(true)
}else if(severity.getValue() == "N/A"){
apc.setHidden(true)
}else {
apc.setHidden (false)
}

1 answer

1 accepted

0 votes
Answer accepted
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 16, 2021 • edited

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

image.pngimage.png

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.

image.png

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 17, 2021

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.

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 17, 2021

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
TAGS
AUG Leaders

Atlassian Community Events