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

Get Issues In Epic in Scripted Field

Paul Tiseo 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 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 # people like this
TAGS
AUG Leaders

Atlassian Community Events