Hi guys!
I have a formula, which should return the linked issues with some condittions(status/priority):
I have tried this code, but no result:
<!-- @@Formula: import com.atlassian.jira.component.ComponentAccessor; import org.apache.commons.lang.StringUtils; DefectKeys = new ArrayList(); outwardLinks = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getIssueObject().getId()); for (issueLink : outwardLinks.iterator()) { if (issueLink.getIssueLinkType().getOutward().equals("is Parent of") && ! issueLink.getDestinationObject().get("status").getName().equals("Closed") && issueLink.getDestinationObject().get("issuetype").getName().equals("Defect") && (issueLink.getDestinationObject().get("priority").getName().equals("Urgent") || issueLink.getDestinationObject().get("priority").getName().equals("High")) ) { DefectKeys.add(issueLink.getDestinationObject().getKey()); } } if (DefectKeys.isEmpty()) return "Empty"; StringUtils.join(DefectKeys, ","); -->
Without the conditions the result is a list of linked issues(children). So the error is in the conditions.
We are using JIRA version 6.4.11.
Any suggestions?
Thank You!
Community moderators have prevented the ability to post new answers.
Hi,
issueLink.getSourceObject() and issueLink.getDestinationObject() return an Issue. Access the name of the issue's status, type and priority, do this:
issueLink.getSourceObject().getPriority().getName()
issueLink.getSourceObject().getIssueType().getName()
issueLink.getSourceObject().getStatus().getName()
Tibor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Were you able to get your code to work? I'm looking for the exact same thing.
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.