Order comments and attachments by creation date


I am currently evaluating the JIRA PDF View plugin via the 1 month free trial. I noticed that when you create a .pdf with the default template, it orders the export in such a way that all similar items follow each other. For instance:for each issue first all the attachments, then all the comments.

Can this be changed in the template? For instance: for every attachment I create (under a single issue), I also include a comment --> I want each comment to be exported together with the attachment it belongs to.



Have more questions? Submit a request


  • 0
    Levente Szabo


    Yes, that's totally possible.

    How? You need to implement a comparator in Groovy (that compares both attachments and comments by their creation date). Then implement a simple Groovy utility class that accepts an issue, extracts all comments and attachments from it, sort them using the comparator, and returns the re-sorted "asset list".

    Finally in the template, modify the rendering code to:

    1. When rendering the current $issue, invoke the utility class by passing the $issue object
    2. Instead of rendering the comments and attachments separately, modify that block to render the "asset list" instead

    That's all.

Please sign in to leave a comment.