Hi,
how to traverse through a Select List (multiple choices) values and count number of values updated in it using groovy script.
i have one requirement where I need to check the number of values updated as part of custom field i,e "Impacted sub-systems" of Select List (multiple choices). Please advice, how to do it?
I tried to use the below code/script based on the answers shared in our Atlassian community.
But unable to traverse for 2nd vlaue, etc using these methods - please suggest what is the right method to achieve the same.
1st Approach tried:
--------------------
//'Impacted sub-systems' is a multiple choice single select list custom field
def componentCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Impacted sub-systems")
def selectedComponents = issue.getCustomFieldValue(componentCF)
selectedComponents?.each { LazyLoadedOption it ->
}
2nd approach tried:
-------------------
def componentCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Impacted sub-systems")
Group group = issue.getCustomFieldValue(componentCF) as Group
if (group){group?.each {
def issueFactory = ComponentAccessor.getIssueFactory()
def issueManager = ComponentAccessor.getIssueManager()
def newIssue = issueFactory.cloneIssue(issue)
}