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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Add the linked issues list into a notification mail

Hi,

I'm trying to add the list of linked issues into a notification mail.

I successfully added customfields value, but I don't know how to get the linked issues list in the email template.

Can you help me doing this ?

Thank you very much,

Eric

3 answers

1 accepted

0 votes
Answer accepted

I found what I need :

#set ($componentManagerClass = $constantsManager.getClass().getClassLoader().findClass('com.atlassian.jira.ComponentManager'))
#set ($issueLinkTypeManagerClass = $constantsManager.getClass().getClassLoader().findClass('com.atlassian.jira.issue.link.IssueLinkTypeManager'))
#set ($method = $componentManagerClass.getDeclaredMethod('getInstance', null))
#set ($componentManager = $method.invoke(null, null))
#set ($issueLinkManager = $componentManager.getIssueLinkManager())
#set ($issueLinkTypeManager = $componentManager.getComponentInstanceOfType($issueLinkTypeManagerClass))

<tr valign="top">
    <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:${textSubtleColour};">Début incident:</strong>
    </td>
    <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">
	
		#foreach($linkedIssue in $issueLinkManager.getLinkCollectionOverrideSecurity($issue).getAllIssues())
			<a href='${baseurl}/browse/$linkedIssue.getKey()'>$linkedIssue.getKey()</a>
			$linkedIssue.getSummary()
			</br>
		#end
    </td>
</tr>

Hi Eric,

I also need to achieve exactly same for my Jira project. Could you please guide me what to be done and how? we also have scriptrunner plug in.

 

Thanks a lot in advance for your support

0 votes
Janet Albion Atlassian Team Mar 05, 2013

In case if you are unaware of this guide to modify the email template https://confluence.atlassian.com/display/JIRA052/Customising+Email+Content

Hi Janet,

Thank you for your repply !

Like I said, I successfully added customfields value into notification email.

But the linked issues are not reachable by $issue.[something]

In other hand, I can retrieve linked issue in a Groovy script.

So I tried to merge the two : template and groovy like below

<%
import ...

MutableIssue issue = (MutableIssue) issue

def inwardLinkList = issueLinkManager.getInwardLinks(issue.getId())
def outwardLinkList = issueLinkManager.getOutwardLinks(issue.getId())

def result = ""

for(item in inwardLinkList){
	result += item.getSourceObject().getKey()
	result += " ;\n "
}

for(item in outwardLinkList){
	result += item.getDestinationObject().getKey()
	result += " ;\n "
}

%>

<tr valign="top">
    <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:${textSubtleColour};">Début incident:</strong>
    </td>
    <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">
        #if ($issue.getCustomFieldValue("customfield_10445"))
            ${result}
        #end
		
    </td>
</tr>

But the notification is sended with the string : "${result}"

I tried $result too but same problem...

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Expose your beautifully crafted Dashboard through the Jira Service Desk Customer Portal

  A picture is worth a thousand words, especially when you're trying to find relationships and understand your data. Here, Dashboards play a vital role in gaining insights from a variety of dat...

386 views 5 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you