Hello,
I am creating a behavior script using ScriptRunner and want to hide some field-based on selected value which is of an Insight object type.
For example:
if Native value(insight field) = XYZ then hide a field, if not XYZ =>do not hide the field.
This behavior is not working for me. Can someone please help?
import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.atlassian.jira.component.ComponentAccessor
def log = Logger.getLogger(getClass())
log.setLevel(Level.DEBUG)
def monthlyMaintenance = getFieldByName("Is this for monthly network maintenance?");
//def tid = getFieldByName("TID and Business Service");
//============================
monthlyMaintenance.setHidden(true);
def tid_Insight = getFieldById("customfield_29540");
def tid_val = tid_Insight.getValue().toString();
def bs_Insight = getFieldById("customfield_29541");
def bs_val = bs_Insight.getValue().toString();
//============================
//ArrayList cascadeValueStore = tid.getValue() as ArrayList
//log.debug("cascadeValueStore----" + cascadeValueStore)
log.debug( "monthlyMaintenance----"+ monthlyMaintenance.getValue())
if (issueContext.projectObject.key == "ITPPM" && issueContext.issueType.name == "Change Log"
// && cascadeValueStore[0] =="INFR" && cascadeValueStore[1] == "Network"){
// && cascadeValueStore.contains("TO") && cascadeValueStore.contains("Systems Monitoring")){
// && tid_val.contains("IAT-1749431") && bs_val.contains("IAT-1806913")){
&& tid_val.contains("TO") && bs_val.contains("Systems Monitoring")){ // only show monthlyMaintenance field if this condition match
monthlyMaintenance.setHidden(false);
}