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,557,708
Community Members
 
Community Events
184
Community Groups

Script not working on Multiselect field

Edited

Hi Team,

I am trying to create a behaviour based on value from multi select field -basically to hide two field but it's not working somehow:

def dropDown =getFieldByName("Environment")
def dropDown2=getFieldByName("Application")

def MultiselectList = getFieldById(getFieldChanged()) // I tried this alternate statement as well -getFieldByName("Name")


def MultiselectListValue =MultiselectList.value as List

if(MultiselectListValue == ["ABC"]) {
dropDown.setHidden(false)
dropDown2.setHidden(false)

}

 

1 answer

1 vote
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.
Aug 15, 2022

Try it like this:

def MultiselectList = getFieldById(getFieldChanged()) // I tried this alternate statement as well -getFieldByName("Name")
def MultiselectListValue =MultiselectList.value as List
def hide = MultiselectListValue.contains("ABC")
def fieldsToHide = ['Environment', 'Application']
fieldsToHide.each{fieldName->
getFieldByName(fieldName).setHidden(hide)
}

It's not working somehow , i want these two drop to be hidden when value is selected as "ABC" in multi select field other wise it should be visible as usual.

Does it matter if the multi select field is project specific ?

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.
Aug 17, 2022

You can try to output some information on your screen for debugging purposes:

def MultiselectList = getFieldById(getFieldChanged()) // I tried this alternate statement as well -getFieldByName("Name")
def MultiselectListValue =MultiselectList.value as List
def hide = MultiselectListValue.contains("ABC")
MultiselectList.setHelpText("Value detected: $MultiselectListValue (${MultiselectListValue.getClass()}) hide=$hide")
def fieldsToHide = ['Environment', 'Application']
fieldsToHide.each{fieldName->
getFieldByName(fieldName).setHidden(hide).setHelpText("Field $fieldName identified. Attempting to set hidden=$hide")
}

What happens when you set that as your server-side script for the Multi Select field?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events