Thanks for reading my query. And hope someone could help me with my trivial question…
I got 3 custom fields:
Issue category - which is a cascading field (customfield_10220)
Functional area - single picklist (customfield_10221)
Resolver group - single picklist (customfield_10222)
Based on the values selected in Issue category field, I want to populate the Functional area and Resolver group fields. I use IF-ELSE-THEN condition statements, but the THEN code block is throwing an error.
Can someone please help with my script below?
def customFields = get(“/rest/api/2/field”)
.asObject(List)
.body
.findAll { (it as Map).custom } as List
//this was added by the scriptrunner cloud example as a way to check the listener is only applied to the correct project
def projectKey = “TEST”
if (issue == null || ((Map) issue.fields.project).key != projectKey) {
logger.info(“Wrong Project ${issue.fields.project.key}”)
return
}
How do you suggest I achieve this? I basically wanted to first validate the values of Issue category and sub-category selected by the user on create or edit event using an IF/ELSE statement (I don’t know how to use SWITCH statement). Then once validated, at the end I want to automate the population of Functional area and Resolver group, hence the code is outside of IF/ELSE statement.