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,300,977
Community Members
 
Community Events
165
Community Groups

How Hide/Show Cascading Field Value?

Edited

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.

  • Customer Service
  • Human Resource
  • Sales
  • Technology
    • Database
    • Development
    • Support
  •  Quality Assurance   

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.

1 answer

1 accepted

0 votes
Answer accepted

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Improving the Create Issue Experience in Jira Service Management Cloud

Hello everyone!  We are very excited to announce some much needed changes to the issue create experience in JSM (the blue "create" button) at the top of the screen.  We have just starte...

241 views 12 7
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