I have an principle to implement. If the issue is cancelled, all its subtasks shall be cancelled automatically without screen checking only if the subtask has an action from current status to the "cancelled" status.
I have following codes but don't know how to get ACTION_ID which can transition the subtask from current status to a given status ( here, the given status is "cancelled" ). any one could kindly help?
def subTasks = issue.getSubTaskObjects()
subTasks.each {
def validationResult = issueService.validateTransition(user, it.id, ACTION_ID, issueInputParameters)
if (validationResult.isValid()) {
def issueResult = issueService.transition(user, validationResult)
}
}
The method I use to get the action id is
import com.opensymphony.workflow.loader.ActionDescriptor
import com.atlassian.jira.workflow.WorkflowTransitionUtil
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl
import com.atlassian.jira.workflow.IssueWorkflowManager
...
WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class);
IssueWorkflowManager issueWflwMan = ComponentManager.getComponentInstanceOfType(IssueWorkflowManager.class);
....
int actionID
def actionName = "Cancelled" //transition name
Collection<ActionDescriptor> coll = issueWflwMan.getAvailableActions(subtaskIssue, user);
for(ActionDescriptor ad : coll) {
if(ad.getName().equals(actionName)) {
actionID = ad.getId();
}
}
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.