Page tree
Skip to end of metadata
Go to start of metadata

Problem: Your Raley notification is sending all of the comments related to an issue, but comments are sorted in ascending order, i.e. from oldest to newest. How to reverse the order so, that the newest comments come first and the oldest would be in the end of the list?


Solution: Reversing of the order is done by applying some Velocity tricks. Here's a working example that you can use in your notification.

Listing of comments in reverse order
<b>Comment History:</b><br>

<table border="0" cellspacing="10">
#set($max = $issue.fields.comment.comments.size() - 1)

#foreach($i in [ $max ..  0 ])
   #set ($comment = $issue.fields.comment.comments.get($i) )   
   <tr>
       <td valign="top"><b>$comment.author.displayName</b></td>
       <td valign="top" nowrap>$jirassimo.formatDate($comment.created, "yyyy-MM-dd HH:mm:ss")</td>
       <td>$!comment.body</td>
   </tr>
   #end  
#end
</table>
  • No labels