Right now I'm in the process of creating a custom script using ScriptRunner that duplicates an existing issue, alters some of it's fields and creates a new one.
One of the things I'd like to is to preserve the Sprint information of a given issue.
To do that I tried the following:
def sprintField = customFields.findByName('Sprint')
I'm attempting to get the custom Sprint field using the above command and the using the IssueService I attempt to fill in the information via parameters this way:
if (sprintField != null) {
params = params.addCustomFieldValue(sprintField.id, [(issue.getCustomFieldValue(sprintField) as ArrayList<Sprint>).collect { it.getId().toString() }
.toArray(new Long[(sprintField.getValue(issue) as ArrayList<Sprint>).size()])] as String[])
}
Unfortunately this does not seem to work. Can anyone shed some light as to how I'm supposed to do that?