Inclusion of Linked Issues in scripted post function email

m
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 17, 2012

Hi,

Is it possible to add a list of linked issues into a scripted post function email template?

Thanks

1 answer

1 accepted

1 vote
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 17, 2012

It's perfectly possible but you will need to write some code.

Eg:

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
issueLinkManager.getOutwardLinks(issue.id).each {issueLink ->
    // filter on issueLink.issueLinkType.name
    out << issueLink.destinationObject.getKey()

}

Alexey Paveliev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 18, 2012

Matthew, just in case you're interested in Inward links as well (eg. "Is blocked by" vs "Blocks")

add this

issueLinkManager.getInwardLinks(issue.id).each {issueLink ->
     out << issueLink.sourceObject.getKey()
 
}

m
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 18, 2012

Hi,

I tried adding both of these to my template but it just outputs all of the above as plain text when the mail is sent...

Do I need to add any additional formatting to these?

Thanks

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 18, 2012

That was just the code. Here is what you put in the template. I'll leave it to you to include the summary etc:

...Other text...

<%
  out << "Linked Issues\n\n"

issueLinkManager.getOutwardLinks(issue.id).each {issueLink ->
    // filter on issueLink.issueLinkType.name
    out <<  issueLink.issueLinkType.outward << " " << issueLink.destinationObject.getKey() << "\n"
}

%>

Alexey Paveliev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 18, 2012
The following will provide output like:
Blocks: In Progress [PR-198] Customer can export order history to Excel

issueLinkManager.getOutwardLinks(issue.id).each {issueLink ->
   def d = issueLink.destinationObject
    out <<  issueLink.issueLinkType.outward << ": " << d.getStatus() << " [" << d.getKey() << "] " << d.getSummary << "\n"
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events