Hi Team,
I want to show custom field based on Component selection. I have written code in Script Runner Behaviour , my code working perfectly when users select one component label. But its not behaving correctly when users select two or more component labels.
If users select two or more component labels , I have to show two or more custom fields.
Note : I have created 40 custom fields and 40 component labels for my client. When ever users select component I need to show/display respective custom fields.
My code is working when users select one component label.
@BaseScript FieldBehaviours fieldBehaviours
def log = Logger.getLogger("com.acme.CreateSubtask");
log.setLevel(Level.DEBUG);
def dashboardCost = getFieldById("customfield_12735");
def devCost = getFieldById("customfield_12736");
def sccdCost = getFieldById("customfield_12737");
def jiraCost = getFieldById("customfield_12738");
def components =getFieldById("components");
def comp= components.getValue()*.getName();
if (comp.toString().contains('Dashboard')){
dashboardCost.setHidden(false);
}
else if(comp.toString().contains('dev')){
devCost.setHidden(false);
}
else if (comp.toString().contains('SCCD')){
sccdCost.setHidden(false);
}
else if (comp.toString().contains('JIRA')){
jiraCost.setHidden(false);
}