It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to display a custom field's options based on another custom field value ?

I have 2 select list ( single choice ) custom fields.

Custom Field1 is countries i.e  Germany,France,Italy

Custom Field2 is cities    i.e.  Köln,Berlin,Paris,Monaco,Milano,Roma

I want to display only Milano and Roma when Custom field 1 is selected as Italy.

I do not use Cascaded Custom Fields, these two fields are distinct.

How can I do that, probably with Scriptrunner Behaviors ?

Thanks in advance !


2 answers

0 votes

HI @Oğuzhan_Kırlangıç 

I think you should create a scripted field for Custom field 2 for reflecting the changes depends on custom field 1


1 ) Download Script Runner Plug in.
2 ) Create a "Scripted Field" Custom field
3) Go to Admin >> Script Field>> Edit the custom field which you have
recently created.
4 ) Below is an example which select the value from select custom field and
push it the same to Scripted field.

eg code : -

here I am returning the value of Select custom field to sctipted field.

def select = getCustomFieldValue("Select")
if (select) {
return select
else {
return null

// This script return the value which you have selected in Select custom field, instead you can

// redefine the code as per your requirement.




0 votes

This Is the code Can You Try This Is Working Script Behaviour 




import com.atlassian.jira.component.ComponentAccessor
def storeName = getFieldByName("Store Name")
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObject(storeName.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
if (getFieldById(getFieldChanged()).getValue()!=null){
String val=getFieldById(getFieldChanged()).getValue() as String


def optionToSelect = options.findAll { it.value in ["HAMDAN STREET STORE"] }
storeName.setFormValue("HAMDAN STREET STORE")
def optionToSelect = options.findAll { it.value in ["AL AIN STORE"] }
storeName.setFormValue("AL AIN STORE")


Suggest an answer

Log in or Sign up to answer

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