HI, I have the following snippet of code via Groovy ScriptRunner.
Issue currIssue = componentManager.getIssueManager().getIssueObject("TESTDEV-712")
def targetVersion = currIssue.getCustomFieldValue(cf)
def fixVersion = currIssue.getFixVersions()
fixInHead = fixVersion.grep('HEAD')
log.debug "Found match"
log.debug "No match"
My test data is:
Target Version = 8102
Fix Version = 8102, HEAD
Expected it to return "Found match" but for some unknown reason, it doesn't see the match. Please help! Thanks!
target version and fix version are both lists.
I would suggest you to change "contains" to "containsAll"
if (fixVersion.containsAll(targetVersion)) log.debug "Found match" else log.debug "No match"
This will work if the target version would be one or multiple selections
To retrieve the list count you can use the size() method. So "fixVersion.size()". The answer depends by the purpose of your script. If you are creating a scripted field just take a look at that: https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+Fields
Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG