Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


What script can I use to restrict the values on a cascade select field?

I have a Cascade Select custom field with the id "19000" and want to restrict the visible values depending on the issue type selected. 

I cannot figure out which script to use... any help would be appreciated 

1 answer

1 vote
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 10, 2021

This should be a good place to start:

Of course, this is for basing one single select on another, not adjusting the list in a cascading select. But it's virtually the same.

Here is a sample script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
def optionsManager = ComponentAccessor.optionsManager

def csFieldName = 'Root Cause'
def csFieldId = 'customfield_19000'
def csFormField = getFieldByName(csFieldName) // or getFieldById(csFieldId)

def issueType =
def issueTypeOptionMap = [
IssueType1:['Option1', 'Option2'],
IssueType2:['Option3', 'Option4']

def allowedOptionsValues = issueTypeOptionMap[issueType]
def csCf = ComponentAccessor.customFieldManager.getCustomFieldObject(csFormField.fieldId)
def config = csCf.getRelevantConfig(issueContext)
def options = optionsManager.getOptions(config)

Map allowedOptions = options.findAll{it.value in allowedOptionsValues}.inject(["":'None']){ Map map, Option opt->
map[opt.optionId as String] = opt.value
} else {
csFormField.setHelpText("No valid options for this issue type:$issueType")

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events