I need a simple script to check if all linked issues which are "is blocked by" are resolved before resolving the issue
import com.atlassian.jira.issue.link.IssueLink;import com.atlassian.jira.component.ComponentAccessor;def allClosed = trueList<IssueLink> allInIssueLinks = ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId());for (link in allInIssueLinks){if(link.issueLinkType.name == "Blocks"){ def linked = link.getSourceObject() if( linked.resolution == null) //You might need to modify this depending on how your project is set up { allClosed = false } }}return allClosed
You might need to change how it determines if an issue is resolved depending on how your project is set up, but this should work.
thanks Ben, shall I add this as validator under simple validator script in workflow transition
@tazeenn
Did it work? If so, could you mark my response as the answer?
Hey Ben, It is not working.
I added this as validator in the transition however the ransiiton is not stopped if an open blocked by link is available. Its still letting the issue closed
import com.atlassian.jira.issue.link.IssueLink;import com.atlassian.jira.component.ComponentAccessor;def allClosed = trueList<IssueLink> allInIssueLinks = ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId());for (link in allInIssueLinks){if(link.issueLinkType.name == "Blocks"){def linked = link.getSourceObject()if( linked.resolution == Unresolved) //You might need to modify this depending on how your project is set up { allClosed = false } }}return allClosed
no luck:( Its still letting the issue close even thought the linked issue is open
It looks like you're new here. Sign in or register to get started.