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
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
One of the newest products in the Microsoft family - Microsoft Teams, is a chat-based hub for teamwork that integrates all the people, content, and tools your team needs to be more engaged and ...
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