Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can use the following templates:

Table of Contents

...

excludeSee also

Show all comments of the task

Code Block
languagexml
titleExample 1, Show all comments of the task
collapsetrue
 #foreach($comment in $comments)
   <p>$comment.getBody()</p>
 #end

Exporting wiki formatted data from Issue comments section

Code Block
languagexml
titleExample 2
collapsetrue
 #foreach($comment in $comments)
  <p>$fieldRenderer.renderWiki2Html($comment.getBody())</p>
#end

Filtering comments by "Comment internal" flag

Code Block
languagexml
titleExample 2, Filtering comments by "Comment Internal" flag3
collapsetrue
<p>Comments:<br />	
#if ($comments != $null && $comments.size() > 0)
 #foreach($comment in $comments)
   #if ($renderer.isCommentInternalServiceDesk($comment)) 
	<span>Internal JIRA SD comment: $comment.getBody()</span><br />
   #end
 #end
#end
</p>

...

Fields rendering in templates

Code Block
languagejava
titleExample 3, Using of field's rendering in templates4
collapsetrue
$assignee
  $fieldRenderer.renderField("T3 Priority Score")
  $fieldRenderer.renderFieldById("customfield_10510")

...

Show all comments and related author of the task in the table format

Code Block
languagexml
titleExample 4, Show all comments and related author of the task in table format5
collapsetrue
#set( $formatString = "EEE, MMM d, ''yy")
<table>
  <thead>
    <tr>
      <th>Comments</th>
    </tr>
  </thead>
  <tbody>
    #foreach($comment in $comments)
      <tr>
        <td>$dateFormatter.withStyle($formatString).format($comment.getCreated()) $comment.getAuthorFullName()</td>
      </tr>
      <tr>
       <td>
         <p>$comment.getBody()</p><hr />
       </td>
      </tr>
    #end
  </tbody>
</table>

...

Show only public comments and related author of the task

Code Block
languagexml
titleExample 5, Show only public comments and related author of the task. If there are no comments display the message about it6
collapsetrue
<p>Public comments for the issue $issue.getKey() with summary "$issue.getSummary()"</p>
<hr />
#if ("$!comments" != "" && $comments.size() > 0)
	#foreach($comment in $comments)
		#if("$!comment.getRoleLevelId()" == "")
			<p>
			   $comment.getCreated() $comment.getAuthorFullName()
			   <br />
			   $comment.getBody()
			</p>
		#end
	#end
#else
	<p>The task has not any comments</p>
#end

...

Show info about all Issue's links, remote links and subtasks

Code Block
languagexml
titleExample 6, Show info about all Issue's links, remote links and subtasks7
collapsetrue
#macro( renderJiraIssues $listTitle, $itemTitle $collection )
		<h4>$title</h4>
		<ul>
			<li>title count: $subTasks.size()</li>
			#foreach($issue in $collection)
				<li>
					<h5>$itemTitle</h5>
					<ul>
						<li>Key: "$issue.getKey()"</li>
						<li>Summary: "$issue.getSummary()"</li>
					</ul>
				</li>
			#end
		</ul>
#end

<p>Public comments for the issue $issue.getKey() with summary "$issue.getSummary()"</p><br />
<ul>
	<li>
		#renderJiraIssues("Subtasks", "Subtask", $subTasks)
	</li>
	<li>
		#renderJiraIssues("Issue Links", "Linked Issue", $links)
	</li>
	<li>
		<h4>Remote Links</h4>
		<ul>
			<li>Remote Links count: $remoteLinks.size()</li>
			#foreach($remoteLink in $remoteLinks)
				<li>
					<h5>Remote link</h5>
					<ul>
						<li>Title: "$remoteLink.getTitle()"</li>
						<li>Url: $remoteLink.getUrl()</li>
					</ul>
				</li>
			#end
		</ul>
	</li>
</ul>

Custom fields rendering in templates 

Info

The customFields variable is available starting with v2.0.4 of the app.


Code Block
languagejava
titleExample 8
collapsetrue
#macro( showIssueAttributes $itemIssue )
	<li>reporter : $itemIssue.reporter</li>
	<li>issue Key : $itemIssue.key</li>
	<li>summary : $itemIssue.summary</li>
	<li>type: $itemIssue.issueType.name</li>
	<li>status: $itemIssue.status.simpleStatus.name</li>
	<li>current user: $currentUser</li>
#end

#macro( getCustomFieldsListAttachments $itemIssue )
	<ul>
		#foreach ($customField in $customFields)
			<li>custom field:
				<ul>
					<li>name: $customField.name</li> ///($customFields is available in v2.0.4 and above)
					<li>id: $customField.id</li>
					<li>value: $renderer.renderField($issue, $customField.name, "empty")</li>
				</ul>
			</li>
		#end
	</ul>
#end

#macro( showAttachments $itemIssue )
	<ul>
		#foreach ($attachment in $itemIssue.attachments)
			<li>attachment:
				<ul>
					<li>filename: $attachment.filename</li>
					<li>id: $attachment.id</li>
					<li>url: $baseUrl/secure/attachment/$attachment.id/$attachment.filename</li>
				</ul>
			</li>
		#end
	</ul>
#end

<p>Issue:
	<ul>
		#showIssueAttributes( $issue )
		<li>Custom fields:
			#getCustomFieldsListAttachments( $issue )
		</li>
		<li>Attachments:
			#showAttachments( $issue )
		</li>
		<li>Subtasks:
			<ul>
				#foreach ($subtask in $subTasks)
					<li>Subtask
						<ul>
							#showIssueAttributes( $subtask )
							<li>Attachments:
								#showAttachments( $subtask )
							</li>
						</ul>
					</li>
				#end
			</ul>
		</li>
	</ul>
</p>


Change date format in Word template for field "created"


Code Block
languagexml
titleExample 9
collapsetrue
$dateFormatter.withStyle("MM.dd.yyyy").format($issue.getCreated())



See also

PDF - Adding Easy PDF Word Issue Templates