Hi,
I would like to do the following:
Let's say I have 2 Issues linked to an epic. Each of those may have in Fix Version/s and entry like:
Issue1 : Fix Version/s: SW15.08, SW15.12
Issue2 : Fix Version/s: SW15.10
Now I would like to show in a scripted field (LatestFixVersion) on epic level the latest Fix Version/s entry in this case SW15.12.
Thanks for you support
Tobias
HI Tobias,
You can try something like
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.comparator.VersionComparator
import com.atlassian.jira.project.version.Version
def issue = issue as Issue
def fixVersionsInIssues = [] as List<Version>
def comparator = new VersionComparator()
ComponentAccessor.getIssueLinkManager().
getOutwardLinks(issue.id)?.
findAll {it.issueLinkType.name == "Epic-Story Link"}?.
each {it -> fixVersionsInIssues.addAll(it.destinationObject?.fixVersions) }
fixVersionsInIssues?.max(comparator)?.nameThe VersionComparator actually compares the versions against their sequence.
Hope that helps,
regards, Thanos
Hi, Thanos... Me again!
I tried using this for my own purposes but it's throwing an error on the "->" as unexpected character "-"
Tried with different Templates but got the same results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lacey,
I think you should correct the greater than symbol here like such:
regards Tobias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I caught that after posting :) So silly of me. However, even with correcting that as well as the Versions slanted brackets, it's still not operational :( I opened a separate question for it on Community.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thanos,
thanks a lot for your quick response, it works ![]()
One more thing: I'm using different issuetypes (SC1Feature,SC2Feature) linked to the epic.
How could I select only the max fixversion of all the issues of just a certain issuetype e.g. just SC1Feature?
Thanks for feedback
regards
Tobias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tobias,
In the above script edit it to include a condition for the issue type.
ComponentAccessor.getIssueLinkManager().
getOutwardLinks(issue.id)?.
findAll {it.issueLinkType.name == "Epic-Story Link" && it.destinationObject.issueType.name == "Bug"}?.
each {it -> fixVersionsInIssues.addAll(it.destinationObject?.fixVersions) }regards, Thanos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thanos,
thanks I tried it with the "it.destinationObject.issueType.name == "Bug" but it seems that this expression is deprecated since v4.0 and instead of this Issue.getIssueTypeObject() shall be used .
so I tried it like this but did not work. Did I miss something here?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.comparator.VersionComparator
import com.atlassian.jira.project.version.Version
def issue = issue as Issue
def fixVersionsInIssues = [] as List<Version>
def comparator = new VersionComparator()
ComponentAccessor.getIssueLinkManager().
getOutwardLinks(issue.id)?.
findAll {it.issueLinkType.name == "Epic-Story Link" && issue.issueTypeObject.name == "Bug"}?.
each {it -> fixVersionsInIssues.addAll(it.destinationObject?.fixVersions) }
fixVersionsInIssues?.max(comparator)?.name
Thanks again for your quick response
regards
Tobias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try
it.destinationObject.issueTypeObject.name == "Bug"
where 'Bug' is the issue type you want to check (SC1Feature)
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.