I have a list of multi-select checkboxes. The checked checkboxes will/should update a static Groups field.
I used the following code in Listener. This allows the Groups field to add the checked options in the checkboxes.
def groups = []
Issue issue = event.issue
def teamsCheckboxesCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(12200L)
//find all values for checkboxes CF
def selectedValues = teamsCheckboxesCF.getValue(issue)*.value
log.warn(">>"+selectedValues)
selectedValues.each { value ->
def groupManager = ComponentAccessor.getGroupManager()
groups.add(groupManager.getGroup(value))
}
def changeHolder = new DefaultIssueChangeHolder()
def mv = new ModifiedValue(issue.getCustomFieldValue(teamsCF), groups)
teamsCF.updateValue(null, issue, mv, changeHolder)
However, when the checkbox is unchecked, the Group remained in the Groups field; it wasn't removed. Hope someone can help. Thanks!