Similar to this question, but I'm running into an error where the auto creating subtask will only create the last option in the checkbox list, and not all options selected after an edit.
Example:
Checkbox field at the parent issue after 1 edit:
- Option 1 - checked
- Option 2
- Option 3 - checked
Expected Results, subtask's summary as:
- Subtask: Option 1
- Subtask: Option 3
Actual Results:
In the listener script, I set Event trigger to Issue Created and Issue Updated. Under Conditions I use:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
def cf = customFieldManager.getCustomFieldObjectsByName("Checkbox")
def cfValue = cf.getAt(0).getValue(issue)
def subtaskSummaries = (cf as Collection<Option>)*.value
if(issue.issueType.name == "Parent" && cfValue != null){
if(!issue.getSubTaskObjects()*.summary.equals(subtaskSummaries)){
return true
}
}
Target Issue Type = Subtask
Subtask summary left blank, no fields copied.
Under Additional issue actions I use:
def cf = customFieldManager.getCustomFieldObjectsByName("Checkbox").getAt(0)
def cfValue = sourceIssue.getCustomFieldValue(cf)
def subtaskSummaries = (cf as Collection<Option>)*.value
subtaskSummaries.each {
if(!sourceIssue.getSubTaskObjects()*.summary.contains(it)){
issue.summary = "Subtask: " + it
}
}Any suggestions why the script skips Subtask: Option 1?