Hi,
I'm new to Jira.
I'm trying to update the status of the sub-task if the parent task changes status to "NR".
All of the workflows have an "Not Required" (not required state).
This is what I have currently tried, however the project is not updated.
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.issue.status.Status
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.event.type.EventDispatchOption
IssueManager im = ComponentAccessor.getIssueManager();
def GroupManager = ComponentAccessor.getGroupManager();
UserManager userManager = ComponentAccessor.getUserManager();
MutableIssue issue = im.getIssueObject("TEST-54");
long project_id = issue.getProjectId();
def loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
def cStatus = issue.getStatus().getName();
def subIssueList = issue.getSubTaskObjects();
MutableIssue subIssue = null;
List subTaskStatus = [];
if(issue.getStatus().getName() == "Not Required"){
subIssueList.each {
it.getStatus().getName();
subIssue = im.getIssueObject(it.getKey());
subIssue.setStatus(issue.getStatus());
subTaskStatus.add(subIssue.getStatus().getName());
im.updateIssue(loggedInUser, subIssue, EventDispatchOption.DO_NOT_DISPATCH, false);
}
}
return subTaskStatus
All of the sub-tasks are show "Not Required" when printing the information in console, however they are not updated under projects.
What do I need to add to save the changes?
And is it possible to automate this for any generic issue/project/workflow?