Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,551,850
Community Members
 
Community Events
184
Community Groups

Disabling Cascading Select List child options

Edited
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 26, 2022

Hi Community,

Is there a way to bulk delete child options from a cascading select list via groovy/scriptrunner ? For example, I have Cascading Select List field with Parent Option as Priority and Child Options as Level1, Level2, Level3, Level4, Level5

Now I want to delete child options Level4 and Level5, keeping Priority parent option intact. This is just a small example, we have hundreds of options that we are looking to bulk delete or disable will also do.

Any suggestions /example will be appreciated.

1 answer

1 accepted

1 vote
Answer accepted
Andrea Pannitti
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.
Jul 15, 2022

Hi @Kishan Sharma,

you can do this running from the ScriptRunner Console the following code:

import com.atlassian.jira.component.ComponentAccessor

def cfCascadingField = ComponentAccessor.customFieldManager.getCustomFieldObjectsByName("Priority").first()
def contextCascadingField = cfCascadingField.configurationSchemes.listIterator().next().oneAndOnlyConfig
def optionsManager = ComponentAccessor.optionsManager
def options = optionsManager.getOptions(cfCascadingField.configurationSchemes.listIterator().next().oneAndOnlyConfig)

def optionsToDeleteList = ["Level4", "Level5"]

options.each {
    it.childOptions.findAll { optionsToDeleteList.contains(it.value) }.each { option ->
        optionsManager.deleteOptionAndChildren(option)
    }
}
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 18, 2022

Awesome, that worked like a charm @Andrea Pannitti thank you so much, appreciate your help 👍😊

How do I disable certain options instead of deleting them?

This does not seem to be working to disable option instead of deleting them:

optionsManager.disableOption(option)

I can still see the option available for selection even though it has been disabled.

 

I am still searching for a solution to subset (show/hide based on specific conditions) the child options in a cascade select list.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events