Hi community, how can I hide the second part of Cascading custom field? I would like to hide the second part base on the selected value of the first part.
For example, I have a field "Dept" and it contains names of all departments.
I would like to hide the sub-value part of the field. Once the user selects Technology then it should show the second sub-value part (Database, Development, Support). I tried the below behaviour script but it didn't work. Any idea how can I make it work?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.fields.config.FieldConfig
import com.atlassian.jira.issue.customfields.option.Options
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.onresolve.jira.groovy.user.FieldBehaviours
def primaryField = getFieldById("customfield_13200")
def subField = getFieldById("customfield_13200:1") //not sure sub value part can be define like this
if (primaryField.value == "Technology") {
subField.setHidden(false) }
else {
subField.setHidden(true)
}
Thank you for your help.
Hi @Shah Baloch ,
unfortunately you can't hide just the second part of your cascading select list.
Your code is incorrect!
def subField = getFieldById("customfield_13200:1") //not sure sub value part ca
In order to take value of second part of your field :
def subField = primaryField.getValue().get("1")
You can change or set that second part value but you can't hide just the second part.
My suggestion is to set a None value for all values in second part where there are no values.
Hope this helps,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.