Condition is not working

Andrew Striletskyi August 7, 2018

I have the following condition (we don't want to resolve any Incident children until the parent Event). But It's not working 

 




import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
import org.apache.log4j.Category
import com.atlassian.jira.issue.link.IssueLink;
import com.opensymphony.workflow.InvalidInputException

def Category log = Category.getInstance("com.onresolve.jira.groovy.LinkedIssues")
Boolean passesCondition = true


IssueLinkManager linkMgr = ComponentAccessor.getIssueLinkManager()


for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {

log.error(link.getIssueLinkType().getName())
log.error(link.getSourceObject().getResolution())
if (link.getIssueLinkType().getName().toString() == "Parent") {
passesCondition = false
}
}

 

1 answer

0 votes
Tansu Akdeniz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 7, 2018

Hi @Andrew Striletskyi,

As I understood, there is a link between two issues with a name "Parent" (not real parent/subtask relation). So, please notice the link direction whether outward or inward.

If there is an outward link, you should use; getOutwardLinks and getDestinationObject() within the code.

Also, please check the Link Name from Admin -> Issue -> Issue Linking page.

Andrew Striletskyi August 7, 2018

If statement executes succesfully. I debug It using log.error statement 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events