Create
cancel
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

Show/Hide field does not work when multiple options are selected

Good morning,

I have a behavior that uses the value of a multi-select drop down field to show another text field when selected, however; when any other value in the multi-select field is also selected, the behavior does not work.   

Any ideas on what I can do to correct this?

def accessPoints = getFieldByName("Access Points")
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def accessPointsField = customFieldManager.getCustomFieldObject(accessPoints.getFieldId())
def accessPointsConfig = accessPointsField.getRelevantConfig(getIssueContext())
def accessPointsOptions = optionsManager.getOptions(accessPointsConfig)
def other = getFieldByName("Other, explanation required access")


if (accessPoints.value == "Other (add detail to access request explanation)") {
 other.setHidden(false)
} else {
other.setHidden(true)
}

I'm sure it is something simple. I just can't seem to figure it out.

 

Thanks!

1 answer

1 vote
Danyal Iqbal Community Leader Jun 25, 2018
accessPoints.value.contains("Other (add detail to access request explanation)") 

Try this.

It did not like that option:other error.png

You can ignore that error.

Groovy is a dynamic language, which means all method and property names are looked up when your code is run, not when it’s compiled, unlike Java. Because of this, the static type checker is not always correct. It is a best-efforts attempt to let you know if there are problems with your code.

Thank you both for the assist! This is working as expected now.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

135 views 1 2
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