Forums

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

How to change the sub-task status automatically?

Bunty
Contributor
January 26, 2019

Hello All,

In our project there is an issue type called "Feature"(parent) it has 2 sub-tasks called "Development" and "Testing". Different workflows for 2 sub-tasks.

Development Sub-task statuses:

NEW, IN PROGRESS, READY TO TEST

Testing sub-task statuses:

NEW, IN PROGRESS, TEST PASSED, TEST FAILS

If "Testing" sub-task issue status moves to the status "TEST FAILS", Development issue status has to move to status "NEW" automatically.

Any help would be greatly appreciated!!

Thanks in Advance,

Bunty

 

 

1 answer

0 votes
Vasiliy Zverev
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.
January 26, 2019

There is the only option to change issue status: make a transition.

There is no buiid-in feature for this, since you should use an add-on like Script Runner. 

Bunty
Contributor
January 27, 2019

Hi @Vasiliy Zverev,

Our Jira application is integrated with the Scrip runner add-on. Do you know any scripts?

 

Thanks,

Bunty.

Vasiliy Zverev
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.
January 28, 2019
Bunty
Contributor
January 29, 2019

Hi @Vasiliy Zverev,

succesfully Changed sub-task status by the below script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueImpl
import com.atlassian.jira.issue.MutableIssue
import org.apache.log4j.Category

Category log = log
log.setLevel(org.apache.log4j.Level.DEBUG);

if( issue.getIssueType().getName().equals("Testing"))
{
log.info(issue.getIssueType().getName())
log.info(issue.getStatus().getStatusCategory().getName())

Issue parentIssue = issue.getParentObject()
log.info(parentIssue.getIssueType())
log.info(parentIssue.getIssueType().getName())
log.info(parentIssue.key)

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
log.info("Getting outward links...")
issueLinkManager.getOutwardLinks(parentIssue.getId()).each {
issueLink ->
MutableIssue linkIssue = issueLink.getDestinationObject() as MutableIssue
log.info(linkIssue.getIssueType())
log.info(linkIssue.getIssueType().getName())
log.info(linkIssue.key)
if ("Development".equals(linkIssue.getIssueType().getName()))
{
log.info("Setting Development task to New")
((IssueImpl) linkIssue).setStatusId("19890");
((IssueImpl) linkIssue).store();
}
}
}

Suggest an answer

Log in or Sign up to answer