I have a ScriptRunner post function that sends out a notification email, but I'm trying to give a condition on a checkbox custom field. There are 3 options to the custom field, but when I use issue.fields.customfield_10133 == "Option1" it is always returning false.
To validate that I am using a valid option, I ran the following in Script Console to validate the value on an issue where it was set to "Option1"
def issueKey = 'KEY-8000'
def customFieldName = 'customfield_10133'
def result = get("/rest/api/2/issue/${issueKey}?fields=${customFieldName}")
.header('Content-Type', 'application/json')
.asObject(Map)
if (result.status == 200) { return result.body.fields[customFieldName] } else { return "Error retrieving issue ${result}" }
Should I use the ID number associated with the option, or is there another way to state my condition?