Hello,
How to make auto set up with Scrip runner if sub-task status changed from ToDo parent task gets status In Progress
JIRA 8.2.1 - Script Runner: 5.6.2.1-jira8
I tried this one:
import com.atlassian.jira.component.pico.ComponentManager;
import com.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;
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller();
WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class);
MutableIssue parent = issue.getParentObject() as MutableIssue
String originalParentStatus = parent.getStatus().getSimpleStatus().getName()
def isDevBacklogStatus = originalParentStatus in ['To Do']
if (isDevBacklogStatus) {
workflowTransitionUtil.setIssue(parent)
workflowTransitionUtil.setUserkey(currentUser)
workflowTransitionUtil.setAction(11)
if (workflowTransitionUtil.validate()) {
workflowTransitionUtil.progress()
}
}
But got an error: use ComponentManager.loadComponent(Class, Collection)
JiraUtils.loadComponent is deprecated and it might be removed within further releases.
loadComponent(Class<T> componentClass)
Deprecated.
useComponentManager.loadComponent(Class, Collection)
See API documentation here. But it is still not removed, so you can still use it. So, it should be a warning instead of error.
Thanks! I am totally green with Script Runner. Maybe you could write how it should be used in full script? :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is nothing wrong with your script.
I just typed it into Script console and it succeeded on transitioning the issue.
You can add some logs to your script like: log.error("trace 1") and see the logs whether it is executed normally.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.