Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to display options depending on the choice of the list of multiple choice

Alexander
Contributor
June 23, 2019

Hi community!
I have script in behaviours plugin and it work in select list (one choice).
But it doesnt work in select list (multiple - choice). Please tell me how fix it?

My script:

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.bc.project.component.ProjectComponent;


def customFieldManager = ComponentAccessor.getCustomFieldManager();

def SystemField = getFieldById(fieldChanged);
def System = getFieldByName("cf1");
def OperationTypes = getFieldByName("cf2");

def SystemField_val = SystemField.getValue();
Map fieldOptions = [:];
fieldOptions.put ("-1", "None");

SystemField_val.each{
def selectListname = it.getAt("name");

switch (selectListname){
case "value cf1" :fieldOptions.putAll (["17477":"cf2_value", "18906":"cf2_value", "17425":"cf2_value", "19302":"cf2_value", "17471":"cf2_value",
"18710":"cf2_value", "17473":"cf2_value", "17472":"cf2_value" ]);
break;
case "value cf1" :fieldOptions.putAll (["17477":"cf2_value", "19701":"cf2_value", "17425":"cf2_value", "19302":"cf2_value", "17471":"cf2_value",
"18710":"cf2_value", "19303":"cf2_value" ]);
break;
case "value cf1" :fieldOptions.putAll (["17477":"cf2_value", "19701":"cf2_value", "17425":"cf2_value", "17479":"cf2_value", "19302":"cf2_value", "18907":"cf2_value"]);
break;
case "value cf1" :fieldOptions.putAll (["17425":"cf2_value", "18710":"Платеж ФСГ"]);
break;
case "value cf1" :fieldOptions.putAll (["17477":"cf2_value", "17425":"cf2_value", "17425":"cf2_value", "17479":"cf2_value", "19302":"cf2_value",
"17471":"cf2_value", "18710":"cf2_value", "19303":"cf2_value", "17473":"cf2_value", "17472":"cf2_value", "18907":"cf2_value"]);
break;
}

}
OperationTypes.setFieldOptions (fieldOptions)

 

Screen fileds:
Cf in screen.PNG

Regards

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team ’25 europe, virtual access, catch team 25 virtually, anytime anywhere, hybrid event, atlassian conference, atlassian learning, ai teamwork, remote attendance, digital access pass, keynote livestream, product announcements, community events

Register for free Team '25 Europe digital access

Get your free all-access digital pass and don’t miss groundbreaking announcements, brand new features and product updates, insight-packed sessions, and exclusive digital content.

Sign up
AUG Leaders

Upcoming Jira Events