Forums

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

I want to show/Hide a field(multi line text box) based on option selected in multi select field. I a

Priyanka khare
Contributor
October 11, 2021

Hello,

 

I want to show/Hide a field(multi line text box) based on option selected in multi select field. I am using the below code but this only hides the "multi line text box" but never shows-

////////////

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor


@BaseScript FieldBehaviours behaviours
def reasonForBlock = getFieldById("customfield_11842") //
def flaggedField = getFieldById("customfield_11829") //
def selectedOption = flaggedField.getValue() as String
log.debug "Selected option: $selectedOption"
if (selectedOption.toString().contains("Other")){

reasonForBlock.setHidden(false)
}
else {
if(reasonForBlock.value)
{
reasonForBlock.setFormValue(null)
}
reasonForBlock.setHidden(true)
}

 

Can someone help?

 

Regards,

Priyanka

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Marina Veselić
July 16, 2019

Samo here. Is there a way to create a constants file/class and invoke those constants across the scripts? Both ones saved on the server and ones written in inline scripts in Jira?

Cheers,

Marina

0 votes
Pujan Ziaie
Contributor
January 31, 2019

I'm looking for a same solution to have more transparence over general variables we use in groovy scripts (e.g. in post-function or Listener or Behavior). Any luck with a solution?

TAGS
AUG Leaders

Atlassian Community Events