Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,360,061
Community Members
 
Community Events
168
Community Groups

Parent Issue Automatic Transition Change when Child Issues are Resolved

Parent Issue Automatic Transition Change when Child Issues are Resolved.

Using Jira Data Center Version.

2 answers

0 votes
Bharathi Rising Star Aug 08, 2022

Hello @Raj_253,

You can use any plug-in's functionality to write a script for this to work. Different plug-ins like Scriptrunner/ JMWE/ cPrime Power Scripts, etc., offer this functionality. Based on the available plug-in in your Jira instance, you can take a look at the corresponding plug-in's documentation to pull the script.

Hope this helps!

Thanks!

import com.atlassian.jira.ComponentManager;
importcom.atlassian.jira.issue.comments.CommentManager;
import com.opensymphony.workflow.WorkflowContext;
import org.apache.log4j.Category;
import com.atlassian.jira.config.SubTaskManager;
import com.atlassian.jira.workflow.WorkflowTransitionUtil;
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl;
import com.atlassian.jira.util.JiraUtils;
import com.atlassian.jira.issue.MutableIssue;

log =Category.getInstance(“com.onresolve.jira.groovy.AutoCloseChildIssues”);String currentUser =((WorkflowContext) transientVars.get(“context”)).getCaller();WorkflowTransitionUtil workflowTransitionUtil =(WorkflowTransitionUtil)JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class);MutableIssue parent = issue.getParentObject();SubTaskManager subTaskManager =ComponentManager.getInstance().getSubTaskManager();Collection subTasks = parent.getSubTaskObjects();if(subTaskManager.subTasksEnabled){boolean transitionParent =true;for(subtask in subTasks){String status = subtask.getStatusObject().getSimpleStatus().getName();if(status !=”Resolved”&& status !=”Testing”&& status !=”Waiting For Approval”&& status !=”Closed”&& status !=”Approved”){
transitionParent =false;}}if(transitionParent){
workflowTransitionUtil.setIssue(parent);
workflowTransitionUtil.setUserkey(currentUser);
workflowTransitionUtil.setAction(5);
workflowTransitionUtil.validate();
workflowTransitionUtil.progress();}}

Suggest an answer

Log in or Sign up to answer