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

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

Accepted Answer
0 votes

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>

 

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)}

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

24,514 views 2 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you