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
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Confluence Data Center is a deployment option that was designed for performance at scale. In other words, Confluence will handle increased traffic much reliably in a clustered environment and yo...
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