Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Thomas Hardin
Contributor
June 25, 2018

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

Suggest an answer

Log in or Sign up to answer
1 vote
Danyal Iqbal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 25, 2018
accessPoints.value.contains("Other (add detail to access request explanation)") 

Try this.

Thomas Hardin
Contributor
June 25, 2018

It did not like that option:other error.png

Roland Holban (Adaptavist)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 25, 2018 edited

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.

Thomas Hardin
Contributor
June 27, 2018

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

TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events