When I change the status from "in progress" to "Closed". I want to validate the Issue that must have at least one "Child of" linked issue and all "Child of" linked issues are “Closed”.
Hi @Diego Chen
You can't do that with out-of-the-box Jira. But, you can achieve this using ScriptRunner if you are free to use an app.
Add a ScriptRunner script validator for your workflow transition. The script will be similar to the one below, there might be some issues with the code but I trust it will be a good start.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.workflow.WorkflowFunctionUtils
def issueLinkManager = ComponentAccessor.getComponent(IssueLinkManager)
def childOfLinks = issueLinkManager.getOutwardLinks(issue.id).findAll { link ->
link.issueLinkType.name == "Child of"
}
if (childOfLinks.isEmpty()) {
// No "Child of" linked issues, validation fails here
return false
}
def allLinkedIssuesClosed = childOfLinks.every { IssueLink link ->
link.destinationObject.status.name == "Closed"
}
return allLinkedIssuesClosed
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.