Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get status/priority of issue linked to other issue in formula in JIRA Misc Custom Fields

Szabolcs Kiss June 22, 2016

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!

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Tibor Hegyi _META-INF_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
June 22, 2016

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

Szabolcs Kiss June 22, 2016

Thank you, Tibor. I'll try it!

Shannon Wright June 13, 2017

Were you able to get your code to work?  I'm looking for the exact same thing.

TAGS
AUG Leaders

Atlassian Community Events