I am using Script Runner (Jira version 7.3), trying to hide a custom field text box (one line) unless "other" is being selected from another custom field drop down.
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.user.util.UserUtil;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
// Get pointers to the custom field(s) required
def cf = customFieldManager.getCustomFieldObjectByName("Cost Center")
def cf1 = customFieldManager.getCustomFieldObjectByName("Cost Center (Other)")
// Get the Value of Select List A
def cfVal = getCustomFieldValue(cf).toString()
// Hide Select List B by default
cf1.setHidden(true)
// If option B is selected in Select List A show Select List B and make it required
if(cfVal == "Other (Fill in next Line)"){
cf1.setHidden(false) // Show Select List B
cf1.setRequired(true) // Make Select List B Required
}
but I am getting an error on all lines where I set.Hidden and set.Required:
Cannot find matching method com.atlassian.jira.issue.fields.CustomFields#setHidden (boolean)
I investigated and compared to other scripts online but could not find why I'm getting this error...
Any help is much appreciated!