Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Trantion condition to allow only if all the task and sub-tasks are closed in an epic.

Marija Ušakova May 16, 2018

Dear @Alexey Matveev

How are you? Hope you are doing great. Is there a way to write a scripted condition to add as a transition condition to allow only if all the task and sub-tasks are closed in an epic in a workflow.

Please let me get some help you. As always many thanks.

 

IssueLinkManager issueLinkManager = ComponentAccessor.issueLinkManager
def found = issueLinkManager.getOutwardLinks(issue.id).any
{
it?.destinationObject?.getStatus().getName() != "Closed" &&
it?.destinationObject?.getIssueType().getName() == 'Story'
}

1 answer

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 16, 2018

Hello @Marija Ušakova,

I am doing great. I hope you are doing great too. Here is the condition:

import com.atlassian.jira.component.ComponentAccessor

passesCondition = true
def issueLinkManager = ComponentAccessor.issueLinkManager

issueLinkManager.getOutwardLinks(issue.id).each{ issuelink ->
if (issuelink?.destinationObject?.getStatus().getName() != "Closed" && issuelink?.destinationObject?.getIssueType().getName() == 'Story') {
passesCondition = false
}
if (issuelink?.destinationObject?.getIssueType().getName() == 'Story') {
issuelink?.destinationObject?.getSubTaskObjects().each{subtask ->
if (subtask?.getStatus().getName() != "Closed") {
passesCondition = false
}
}
}

}

Suggest an answer

Log in or Sign up to answer