Hi,
I want to use a "send custom email" post-function with script runner. In the body of my email, I would like to get the issue key of eventual linked issue.
Any ideas please ?
Thanks
Melissa
You can get all linked issues like this
ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())
What does "eventual linked issue" actually mean? This can be quite complex.
Hi both, @Jamie Echlin [Adaptavist] @Vasiliy Zverev
thanks for your answer. Do not pay attention to the "eventual" liked issues. sorry it was confusing and does not matter.
here is my email and what I tried to show the linked issue reference thanks to Vasiliy's comment: (send custom email post-function script). But it returned into a script error. Any ideas? thanks for your help
<p>Dear all,</p>
<p>For your information, this NPC study has been reviewed with your teams. Please find attached the detailed Impact Analysis.</p> <p>You can also log in directly our tool JIRA: <a> "https://aptp-alm.accenture.com/jira/browse/$issue.key"</a></p>
<p>Summary: ${issue.summary}</p>
<p>Description: ${issue.description}*</p>
<p>SCOPE restriction:</p>
<p>CAP volume:</p>
<p>First trade planned:</p>
<p>IT development:</p>
<p><% out << issue.getCustomFieldValue(componentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())%></p>
<p>Best Regards,</p>
<p>NPC team
Can you remove the "issue.getCustomFieldValue", not sure why you have that.
I used the following code in the "Email template" section. It loops through the Linked Issues and builds out a list of linked issues (Please excuse the code as I don't claim to be a developer by any means ).
I hope this helps. ...Cheers!
<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>
It looks like you're new here. Sign in or register to get started.