I saw this question posted earlier but the suggested answer doesn't actually answer the question. That answer seemed to explain how to find a specific value.
I am, however, wanting to write a script to show issues that have more than one value selected in a multi-select field.
Use case: we have a Program Increment field on epics. This field is multi-select so we can report on epics that take more than one PI to complete. I want to run a script to show me epics where more than one option is selected in the Program Increment multi-select field.
Hi Cindi
If you are going to groovy it, as Martin suggested, start with a JQL query to narrow results and then you can cycle through a find the ones that have more than one entry and "do" something you would like.
This would need tweaking to your tastes
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def sourceField = customFieldManager.getCustomFieldObject('customfield_10000') /need your actual # for Program Increment
defjqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def
searchService = ComponentAccessor.getComponent(SearchService)
def
query = jqlQueryParser.parseQuery(
"project = myproject AND issuetype = Epic and 'Program Increment' is not EMPTY"
)
def
search = searchService.search(user, query, PagerFilter.getUnlimitedFilter())
def
issues = search.getResults()
issues.
each
{ issue ->
if (issue.getCustomFieldValue(sourceField).size()>1) {
do something! (spit out a list etc...)
}
}
Hope this helps as well.
Hi @Cindi Cunningham , welcome on the community. I'm not aware of possibility to achieve this using JQL by default.
If you just want to run a groovy script, I think the most effective approach is to
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank-you. I will try that!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.