Hello!
I would like to iterate over a custom field of type multi group picker in groovy to create separate tickets for each group in my custom field. The split itself is working fine no worries (in another scenario with ApplicationUsers being a collection). The thing that is not working is to have the iteration over the groups in that multi group picker field. I think I have an issue with the collection supplying not the group name but some internals. Here is the relevant code snippet there is some other code ... which works fine and has no influence to the issue:
log.setLevel(Level.DEBUG)
log.debug "Split issue STARTED"
CustomField supportersCf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(13704) // customField All Supporters (Multi-Group-CustomField)
Collection<String> groups= (Collection) issue.getCustomFieldValue(supportersCf)
log.debug "Choosen source customField: " + supportersCf
groups.each { it ->
log.debug "GroupSplit loop STARTED"
def newIssue = issueFactory.cloneIssue(issue)
newIssue.setProjectId(issue.projectId)
newIssue.setDescription(issue.description)
newIssue.issueTypeId = "11601"
log.debug "Assignee: " + newIssue.getAssignee()
...
newIssue.setCustomFieldValue(customFieldManager.getCustomFieldObject(13704), it) // customField All Supporters (Multi-Group-CustomField)
newIssue.setSummary(issue.getCustomFieldValue(surname) + ", " + issue.getCustomFieldValue(firstname))
Map<String, Object> newIssueParams = ["issue": newIssue] as Map<String, Object>
issueManager.createIssueObject(currentUser, newIssueParams)
IssueLinkManager linkManager = ComponentAccessor.getIssueLinkManager()
log.debug("Issue Link Types : " + IssueLinkType)
linkManager.createIssueLink(issue.getId(), newIssue.getId(), 10400, 1, currentUser);
log.debug "GroupSplit loop END"
}//each end
log.debug "Split issue END"
Any help is highly appreciated!!
Thank you!