Displaying Sprint in Issue Update Emails

Dakota Pierone
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 13, 2018

I have made it so that when an issue is updated that the sprint will be shown in the email. This works 99% of the time. 

But, seemingly at random it will fail to render the sprint. 

This shows a NullPointerException in the email. A snippet of the error.

"#toList($splitSprintData) An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug. Details: ------- java.lang.NullPointerException at com.atlassian.velocity.htmlsafe.introspection.ReturnValueAnnotator.getAnnotationsForMethod(ReturnValueAnnotator.java:38) at com.atlassian.velocity.htmlsafe.introspection.AnnotationBoxingUberspect.getMethodAnnotations(AnnotationBoxingUberspect.java:292) at com.atlassian.velocity.htmlsafe.introspection.HtmlSafeAnnotationBoxingUberspect.getMethodAnnotations(HtmlSafeAnnotationBoxingUberspect.java:29) at com.atlassian.velocity.htmlsafe.introspection.AnnotationBoxingUberspect.getMethod(AnnotationBoxingUberspect.java:117) at "

 

We are on version 7.6.7.

Here is what I added to the "C:\Program Files\Atlassian\JIRA\atlassian-jira\WEB-INF\classes\templates\email\html\issueupdated.vm"

 

"#macro(toList $collection)
#set($tmp = [])
#foreach($item in $collection)
#set($changed = $tmp.add($item))
#end
#set($collection = $tmp)
#end

#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_10005"))
#if ($issue.getCustomFieldValue($customfield))
#set ($sprintValue = "$issue.getCustomFieldValue($customfield)")
#set ($stringLength = $sprintValue.length() - 1)
#set ($sprintName = $sprintValue.substring(1,$stringLength))
#set ($startofName = $sprintName.indexOf("[")+1)
#set ($sprintName = $sprintName.substring($startofName,$sprintName.lastIndexOf("]")))

#set ($sprint = {})
#foreach($sprintData in $sprintName.split(","))
#if ($sprintData && "$!sprintData" != "")
#set ($splitSprintData = $sprintData.split("="))

#if ($splitSprintData && "$!splitSprintData" != "")
#toList($splitSprintData)

#if($splitSprintData.size() == 2)
#set ($dummy = $sprint.put($splitSprintData.get(0), $splitSprintData.get(1)))
#else
#set ($dummy = $sprint.put($splitSprintData.get(0), ""))
#end
#end
#end
#end

#set ($sprintUrl = "${baseurl}/secure/RapidBoard.jspa?rapidView=" + $sprint.get("rapidViewId") + "&id=" + $sprint.get("id"))

#set ($sprintFormatting = '<table class="keyvalue-table"><tr><th>' + $textutils.htmlEncode($customfield.name) + ':</th><td><a href="' + $sprintUrl + '">' + $sprint.get("name") + '</a></td></tr></table>')

#rowWrapperNormal($sprintFormatting '' 'wrapper-special-margin')
#end"

 

Let me know if you need anymore information.

0 answers

Suggest an answer

Log in or Sign up to answer