Script to display specific values in select list depends on another select list value

I need to develop a script which will allow to display only specific values (B2,B3)from a select list B when A1 value has been selected in field A.

1 answer

0 votes

Hello Lynn.

The way that you would apply this would be depending wether your fields are statically or dynamically populated.

If they are statically populated you can use a custom field that is a cascading select. If you don't know how to set one up, let me know and I will prep a documented example for you.

If they are dinamically populated you might need to use something like we have in our documentation here.

if (getActionName() == "Terminate") {

def constantsManager = ComponentAccessor.getConstantsManager()

//Here you filter from your options def allowedResolutions = constantsManager.getResolutionObjects().findAll { it.name in ["Won't Fix", "Incomplete", "Cannot Reproduce"] }
//here you restrict your options with setFieldOptions getFieldById(RESOLUTION).setFieldOptions(allowedResolutions) }

In the example, they are dependent on the action name(line 1 of the script), but you can make them dependent on a field value with getFieldValue(). If you need further help please don't hessitate to ask.

Cheers
DYelamos

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,138 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you