I have a screen with a cascading select list called "Root Cause", if the second list = to "Cannot Reproduce" I want to set the Resolution field to "Cannot Reproduce" automatically for the user. I'm having trouble with reading the values in the Root Cause field though. I'm using Behaviours in Script Runner to accomplish this. I have the script on the Root Cause field.
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.RESOLUTION
def rootCause = getFieldByName("Root Cause")
def rcVal = rootCause.getFormValue() as Map
if (rcVal.get("1") == "Cannot Reproduce")
{
//This part works, the if statement doesn't
def constantsManager = ComponentAccessor.constantsManager
def allowedResolutions = constantsManager.resolutions.findAll
{
it.name in ["Cannot Reproduce"]
}
getFieldById(RESOLUTION).setFieldOptions(allowedResolutions)
}