Overview
I'm attempting to set the value of a Checkbox field when automagically creating new issues. The value is copied from the issue that triggered the listener in certain scenarios.
Problem
I'm able to copy the value when I hard code the strings, like:
Issues.create('DEMO', issueType){
setSummary("Test")
setCustomFieldValue("Checkbox Field", "Foo", "Bar")
}However, if I attempt to grab the values from the trigger issue and reformat to a similar looking stringusing:
def originalCheckboxValue = issue.getCustomFieldValue("Checkbox Field").collect{'"' + it + '"'} as String
def cleanStringValues = originalCheckboxValue.collect{'"' + it + '"'} as String
def grossCleaner = originalCheckboxValue.replaceAll("[\\[\\](){}]","")The values return as: `"Foo", "Bar" as expected.
and attempt to set like:
setCustomFieldValue("Checkbox Field", grossCleaner) Setting the field fails and I receive the error:
com.adaptavist.hapi.jira.issues.exceptions.InvalidOptionException: Invalid option. Available options are: Foo[16500], Bar[16501], Demo[16502], Value[16503]
Question
Has anyone found a way to set checkbox field types when copying the value of an old field? I see a lot for auto-setting the formValue, but not a ton using Issues.create.