Hi All! Newbie here!
I know someone can help :)
I have read this post....
I'm having the same issue. My workflows for parent and subtask are different. What i'm wanting is to transition from "Validated" to "Records Requested" in the parent workflow based on its subtasks reaching a workflow state of "Passed". As mentioned the parent and the subtask have different workflows.
This was my starting code from the previous post but i've done nothing to it. Please could someone thow a hand and tell me what changes i need to make? I did read i needed....
"a script on the sub-task workflow. You can either hard-code the action ID or look it up by name from the WorkflowManager)"
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
String originalParentStatus = parent.status?.name
def isDevBacklogStatus = originalParentStatus in ['Next Up Dev', 'Backlog Dev', 'Selected for Development']
if (isDevBacklogStatus) {
workflowTransitionUtil.setIssue(parent)
workflowTransitionUtil.setUserkey(currentUser)
workflowTransitionUtil.setAction(31)
if (workflowTransitionUtil.validate()) {
workflowTransitionUtil.progress()
}
}
Thanks in advance and hoping for a favourable reply :)
Hi Darren,
I think you have a couple of options here. The first option is to use a workflow transition condition. I found a post where someone else has done this exact same thing here (https://community.atlassian.com/t5/Answers-Developer-Questions/Help-with-Parent-Transitions-upon-Sub-Tasks-Transitioning/qaq-p/495747)
You might not be able to get that to work with your workflow setup (i.e. the parent task having a different workflow to the subtask, although I think it will be fine). If you struggle with that you could modify the approach slightly by using a ScriptRunner script condition instead of a sub-task blocking condition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.