The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Question about "Send a custom email" Post Function and helper.issueTable

Guy Anela
Contributor
January 2, 2018

Hi,

I configured the "Send a custom email" Post Function as follows so it includes "Linked Issues" in the email... 

Condition and Configuration:

config.a="issue in linkedIssues("+issue.key+")"

Email Template:

<b>Linked Issues:</b>
${helper.issueTable(a, 10)}

 

It successfully displays a table with the linked issues, BUT it shows ALL of the columns/fields that you would normally see in the JIRA JQL search results. Is there a way to limit the columns that display in the email? If not, is there another way to go about this? ...I only want to display a few fields (e.g. Issue Key, Summary, Status).

 

Thanks in advance!

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Guy Anela
Contributor
January 3, 2018

I was able to resolve this by looping through the Linked Issues and building out the list of linked issues (Please excuse the code as I don't claim to be a developer by any means :)).

...I hope it helps someone else.

 <b>Linked Issues:</b> <br>

<ul>
<%

def outwardlinks = com.atlassian.jira.component.ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())
def inwardlinks = com.atlassian.jira.component.ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId())
def oCounter=0
def iCounter=0


// Check for Outward Links...
if (outwardlinks)

for (id in outwardlinks) {
def linkedissueKey = com.atlassian.jira.component.ComponentAccessor.getIssueManager().getIssueObject(outwardlinks[oCounter].destinationId).key
def linkedissueSummary = com.atlassian.jira.component.ComponentAccessor.getIssueManager().getIssueObject(outwardlinks[oCounter].destinationId).summary
def linkedissueStatus = com.atlassian.jira.component.ComponentAccessor.getIssueManager().getIssueObject(outwardlinks[oCounter].destinationId).status.name

out << "<li><a href='https://jira.domain.com/browse/"+linkedissueKey+"'>"+linkedissueKey+"</a> "
out << "("+linkedissueStatus+"):"
out << linkedissueSummary+"</li><br>"

oCounter ++
}


// Check for Inward Links...
if (inwardlinks)

for (id in inwardlinks) {
def linkedissueKey = com.atlassian.jira.component.ComponentAccessor.getIssueManager().getIssueObject(inwardlinks[iCounter].sourceId).key
def linkedissueSummary = com.atlassian.jira.component.ComponentAccessor.getIssueManager().getIssueObject(inwardlinks[iCounter].sourceId).summary
def linkedissueStatus = com.atlassian.jira.component.ComponentAccessor.getIssueManager().getIssueObject(inwardlinks[iCounter].sourceId).status.name

out << "<li><a href='https://jira.domain.com/browse/"+linkedissueKey+"'>"+linkedissueKey+"</a> "
out << "("+linkedissueStatus+"):"
out << linkedissueSummary+"</li><br>"


iCounter ++
}

%>

</ul>

 

Guy Anela
Contributor
January 3, 2018

I'm still interested in whether or not you can limit the columns/fields displayed in the results when using the following solution...

 Condition and Configuration:

config.a="issue in linkedIssues("+issue.key+")"

Email Template:

<b>Linked Issues:</b>
${helper.issueTable(a, 10)}
NCFMS Renewals
October 15, 2018

Any chance you would know how to script just the linked issues from other projects? 
I'm attempting to do pretty much the same thing linking issues from multiple projects to one Release Management project.

Only problem is I have Build request subtasks that I don't want showing up on the RMT main release ticket...but I do want to see the linked issues that will be in the Release itself...see screen shot:

image.png

Thanks--Lara