Forums

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

Condition is not working

Andrew Striletskyi
Contributor
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 Champion
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
Contributor
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
atlassian, mindful member, mindful member badge, atlassian community, community kudos, community giveaway, atlassian swag, community values, empathy and kindness, badge challenge, atlassian learning, community engagement, swag giveaway

Earn a Badge, Win a Prize 🎁

Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!

Start here
AUG Leaders

Atlassian Community Events