Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bypass condition based on linked issues

John Miller
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 10, 2020

Hello,

I have a postfunction to transition linked issues based on the primary task.


import com.atlassian.jira.ComponentManager
import org.apache.log4j.Category
import com.atlassian.jira.issue.link.IssueLink;
import com.opensymphony.workflow.InvalidInputException
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.workflow.WorkflowTransitionUtil;
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl;
import com.atlassian.jira.util.JiraUtils;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor

WorkflowTransitionUtil workflowTransitionUtil = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class );
def linkType = ["Extension"]
def linkMgr = ComponentAccessor.getIssueLinkManager()
for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {
if ((linkType.contains(link.issueLinkType.name))) {
Collection feature = linkMgr.getInwardLinks(issue.id).findAll {it.getIssueLinkType()?.getName() == "Extension"}

feature .each{ issueLink ->
IssueManager im = ComponentAccessor.getIssueManager()
MutableIssue issueMutable = im.getIssueObject(issueLink.getSourceObject().getKey());
log.debug issueMutable
workflowTransitionUtil.setIssue (issueMutable)
workflowTransitionUtil.setAction (101)
workflowTransitionUtil.validate();
workflowTransitionUtil.progress();


}
}
}

 

The above code is working fine. To stop user from updating statuses I've added a condition to block the transition on the linked issues if there's an existing outward link. How to Bypass this condition?

 

Thanks.

0 answers

Suggest an answer

Log in or Sign up to answer