Work Flow with full comments list.

Below is a workflow I use to notify non registered users that their ticket is complete. When an issue goes to complete status, this fires off an email to the customer email to inform them on the status change.

Works a treat but.

If there a way to have all the comments on the ticket laid out in chronological order from first to last?

Currently is it just showing the first and last comment. I would like to to show all the comments on said issue.

Any help, pointers would be appreciated.

rule Notify Nonregistered User on Ticket Complete

 when HD_State.becomes({Complete})
&& Customer email != null{
sendMail(Customer email,"[HelpDesk Ticket Staus Complete] [Issue"
+getId()
+"]",Customer email
+"Your ticket has been closed as complete.<br/><br/>You will find a summary of your ticket at the bottom of this E-Mail<br/><br/>If you feel the issue is not resolved, please reply to this E-Mail with any additional information and we will look at it again. <br/><br/><br/>Regards, HelpDesk.<br/><br/>"
+"<b>Ticket Name:"
+summary
+"</b><br/>"
+wikify(description)
+"<br/>Comments:<br/>"
+wikify(comments.first.text + " Created on " + comments.first.created.format(mediumDateTime))
+"<br/>"
+wikify(comments.last.text + " Created on " + comments.last.created.format(mediumDateTime)));
}
2 comments
Comment actions Permalink
Hi Ian,

Thank you for using YouTrack!

You can iterate over comments using for each construction:

var commentsText = ""; 
for each comment in comments { 
  commentsText = commentsText + "</br>" + 
    wikify(comment.text + " Created on " + comment.created.format(mediumDateTime)); 
}
prettyPrint();
0
Comment actions Permalink
Hi Mariya

Works like a charm. From here I can get it laid out the way I need.

Thanks for the speedy reply.
0

Please sign in to leave a comment.