Hi All,
This question has been asked multiple time on the forum and i referred below links to accomplish this, but still not successful
I have a Parent issue workflow:
P1->P2->P3
Parent issue is currently in P2 stage
Subtask Issue workflow:
S1->S2->S3
Subtask status is S2
When Ssubtask moves from S2 to S3 , parent should move from P2 to P3.
I am using script runner plugin and added the post function in the subtask workflow, but still not able to change the status of the parent issue.
Please help
This script will transition your issue.
Just change "211" from my code to the action you want in your post function
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.util.JiraUtils;
import com.atlassian.jira.workflow.WorkflowTransitionUtil;
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.util.ErrorCollection;
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
WorkflowTransitionUtil workflowTransitionUtil = JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class);
workflowTransitionUtil.setIssue((MutableIssue)issue);
workflowTransitionUtil.setUserkey(currentUser.getKey());
workflowTransitionUtil.setAction(211);
if (workflowTransitionUtil.validate().getErrorMessages().size() == 0) {
workflowTransitionUtil.progress();
}
Hi @Nir Haimov thanks for the reply.
But I want to change parent status based on change in subtask status. This script might need to be pasted in subtask post function and does not work if I use P3 instead of 211
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Hemanshu Sood,
Use this as post-function in your sub-task.
change this line:
workflowTransitionUtil.setIssue((MutableIssue)issue);
to:
workflowTransitionUtil.setIssue((MutableIssue)issue.getParentObject());
Yes, 211 is your P3 (but actionId and not statusId), and it will work :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.