Hi everybody,
I'm new to Script. I'm working on post function, I create/clone Issue and in Condition execution, I want to return True value with condition: If the status of linked issue == "Closed". I have script as below: issue.getLinkedIssues("relates to").status.name.toString() == "Closed"
But It does not work well. So How can I get the status of link issue?
hi @Thao Nguyen Thi Thu welcome on the community :)
I think the problem here is that issue.getLinkedIssues method does not exist.
You should use something like:
def linkedIssue;
List<IssueLink> outwardLinks = issueLinkManager.getOutwardLinks(issue.getId())
.stream()
.filter({ linkName == "relates to" })
.collect(Collectors.toList())
if (outwardLinks.size() > 0) {
linkedIssue = outwardLinks.get(0).destinationObject
}
if(!linkedIssue){
List<IssueLink> outwardLinks = issueLinkManager.getInwardLinks(issue.getId())
.stream()
.filter({ linkName == "relates to" })
.collect(Collectors.toList())
if (outwardLinks.size() > 0) {
linkedIssue = outwardLinks.get(0).destinationObject
}
}
if(linkedIssue){
return linkedIssue.status.name == "Closed"
}
return true //returning True because there is no issue linked with link type "relates to"
Thank you a lot Martin Bayer, It's ok for this post function.
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.