I am new to velocity, and trying to figure out how to create a JIRA release note template that groups tickets by a custom field and displays wiki markup formatting as the description from another custom field. Below is my attempt at solving this request, but it isn't returning anything except for the ticket numbers. Any help is greatly appreciated!
#disable_html_escaping() #set($rendererManager = $componentManager.getRendererManager()) #set($wikiRenderer = $rendererManager.getRendererForType('atlassian-wiki-renderer')) #set($none = []) #set($ownerSupport = []) #set($sales = []) #set($terminals = []) #set($accounting = []) #set($procurement = []) #macro (createIssueList $issueList $heading) #set($customFields = $customFieldManager.getCustomFieldObject($issue.project.getLong("id"), $issue.issueType.getString("id"))) #set ($ircontext = $issue.getIssueTypeObject()) <h3><strong>$heading</strong></h3> <ol> #foreach($customField in $customFields) #if($customField.name.equals("User Friendly Release Note")) #set($value = $customField.getValue($issue)) #foreach($issue in $issueList) <li><a href='$!requestContext.baseUrl/browse/$issue.key'>$issue.key</a> - $value - $wikiRenderer.render($value, $ircontext) - $customField.getValue($issue)</li> #end #end #end </ol> <br> #end <title>$textUtils.htmlEncode($action.getText('release.notes.text.title', $project, $version))</title> <title></title> <body> <div class="ops-cont"> <ul class="ops"> <li> <a class="button first last" href="$!requestContext.baseUrl/secure/ConfigureReleaseNote.jspa?projectId=${versionObj.projectObject.id}&version=${versionObj.id}">$action.getText('releasenotes.configure')</a> </li> </ul> </div> #foreach($issueType in $issueTypes) #if($issueType.issues.size() > 0) #foreach($issue in $issueType.issues) #set($groups = $customFieldManager.getCustomFieldObject($issue.project.getLong("id"), $issue.issueType.getString("id"))) #set($groupFound = 0) #foreach($customField in $groups) #if($customField.name == "Release Note Audience") #set($groupName = $customField.getValue($issue)) #end #end #if ($groupName == "Owner Support") $ownerSupport.add($issue) #set($groupFound = 1) #end #if ($groupName == "Sales Reps") $sales.add($issue) #set($groupFound = 1) #end #if ($groupName == "Terminals") $terminals.add($issue) #set($groupFound = 1) #end #if ($groupName == "Accounting") $accounting.add($issue) #set($groupFound = 1) #end #if ($groupName == "Procurement") $procurement.add($issue) #set($groupFound = 1) #end #if($groupFound == 0) $none.add($issue) #end #end #end #end <h1><strong>$action.getText('release.notes.heading', $project, $version)</strong></h1> #if ($ownerSupport.size() > 0) #createIssueList($ownerSupport "Owner Support Release Highlights") #end #if ($sales.size() > 0) #createIssueList($sales "Sales Reps Release Highlights") #end #if ($terminals.size() > 0) #createIssueList($terminals "Terminal Release Highlights") #end #if ($accounting.size() > 0) #createIssueList($accounting "Accounting Release Highlights") #end #if ($procurement.size() > 0) #createIssueList($procurement "Procurement Release Highlights") #end #if ($none.size() > 0) #createIssueList($none "Misc Release Highlights") #end </body>
I've found that separating the template and the code works best.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.