Hi,
I want to transition main issue to "Open" when all linked issues are closed.
kindly provide me a script. I was using automation rules when linked issue is closed, main ticket is transitioned to Open. But it is not verifying that all linked issues must be closed so that issue is transitioned.
Thanks
This is not possible in stock Jira, you will plugins like
Using them you can post functions for workflow, which will solve your problem.
Hi, I am using Script runner.
Please see my code below:
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
import org.apache.log4j.Category
import com.opensymphony.workflow.WorkflowContext
import com.atlassian.jira.workflow.WorkflowTransitionUtil;
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl;
import com.atlassian.jira.util.JiraUtils;
import com.atlassian.jira.issue.comments.CommentManager;
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.issue.MutableIssue
log.setLevel(org.apache.log4j.Level.DEBUG)
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller();
WorkflowTransitionUtil workflowTransitionUtil = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class );
log.debug "Original: ${issue.getId()}, ${issue.getKey()}. DETECTED " + issue.getStatus().name
List<IssueLink> allInIssueLink = issueLinkManager.getInwardLinks(issue.getId());
for (Iterator<IssueLink> inIterator = allInIssueLink.iterator(); inIterator.hasNext();) {
IssueLink issueLink = (IssueLink) inIterator.next();
def linkedIssue = issueLink.getDestinationObject();
log.debug "linked: ${linkedIssue.getId()}, ${linkedIssue.getKey()}. DETECTED " + linkedIssue.getStatus().name
if (linkedIssue.getStatus().name.equals("Open")) { // STATO della issue collegata
log.debug "linked Content: ${linkedIssue.getId()}, ${linkedIssue.getKey()}."
//We can transition the parent ticket
log.debug "start transition"
workflowTransitionUtil.setIssue((MutableIssue) linkedIssue);
workflowTransitionUtil.setUserkey(currentUser);
workflowTransitionUtil.setAction (221); //Transition ID
workflowTransitionUtil.validate();
workflowTransitionUtil.progress();
log.debug "end transition"
}
}
The issue is not transitioned.
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.