Hello Team,
im using the below code in post function of a transition to check if all the subtasks are in "Completed" status and to move the parent to "Completed".
however the code is not working .
can anyone please help me on this?
import com.opensymphony.workflow.WorkflowContext;
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;
import com.atlassian.jira.component.ComponentAccessor
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller()
WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class)
MutableIssue parent = issue.getParentObject() as MutableIssue
if(parent){
passesCondition = true
def subTasks = parent.getSubTaskObjects()
subTasks.each{if(!(it.getStatus().name=="Completed"))
{
passesCondition = false
}
}
if (passesCondition) {
workflowTransitionUtil.setIssue(parent)
workflowTransitionUtil.setUserkey(currentUser)
workflowTransitionUtil.setAction(61)
if (workflowTransitionUtil.validate()) {
workflowTransitionUtil.progress()
}
}
}
...add logging to your script and find out what is happening ?
Where did you put this Post Function (before or after what other Post Functions ?)
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.