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

Get Issues In Epic in Scripted Field

Paul Tiseo
Contributor
August 7, 2018

Using ScriptRunner for JIRA (Server), I want to create a custom field (HTML) that shows the ID and Summary fields of the child issues in the epic. How would I get that list of data using JIRA's API?

1 comment

Comment

Log in or Sign up to comment
Paul Tiseo
Contributor
August 7, 2018

Ended up solving it myself:

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.link.IssueLinkTypeManager

IssueLinkTypeManager issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager)
IssueLinkManager issueLinkManager = ComponentAccessor.issueLinkManager

def sb = new StringBuilder()

def linkType = issueLinkTypeManager.getIssueLinkTypes(false).find{ it.name == 'Epic-Story Link' }
def issueLinkList = issueLinkManager.getOutwardLinks(issue.id).findAll{ it.getLinkTypeId() == linkType.getId() }
for (issueLink in issueLinkList) {
def childIssue = issueLink.getDestinationObject()
sb <<= '<a href=\'https://projects.jtafla.com/browse/'
sb <<= childIssue.getKey()
sb <<= '\'>'
sb <<= childIssue.getKey()
sb <<= '</a> ('
sb <<= childIssue.getSummary()
sb <<= '), '
}
return sb
Like • 6 people like this
TAGS
atlassian, team '25, conference, certifications, bootcamps, training experience, anaheim ca,

Want to make the most of Team ‘25?

Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.

Learn more
AUG Leaders

Atlassian Community Events