{{issue.comments.last.body}} not working correctly in HTML email notifications.

Larry Barker October 10, 2017

Hi,

We are using Automation for JIRA SD cloud and I have currently setup alert email notifications that are set to be HTML.  I'm using {{issue.comments.last.body}} within the body of the email and it is not coming through correctly even though everything is set as HTML.  Only the {{issue.comments.last.body}} field appears to have this issue.   The email come through ok with the other components but as soon as that field value is placed within the email it is showing all HTML tag/formatting as text for any values of that field.

Have you seen this before?  

Thank you,
Larry

3 answers

1 vote
Adam Hill February 24, 2022

Very late comment on this item but I came across it whilst faced with the same issue.  In case someone else follows the same path, I ended up using the below which worked as expected:

{{issue.comments.last.body.html}}

 

NB I needed to uncheck "Convert line breaks to HTML line breaks" to ensure spacing was as desired.

Meredith February 13, 2024

This worked perfectly!

0 votes
Preston July 28, 2020

Are your emails displaying something like this?

 

{color:#fdsgds} Hi there {quote}

{quote} {quote}

 

When it should look like this:

 

Hi there

 

If that's the issue you're having, I'm having the same thing and ended up using

{{issue.comments.last.body.replaceAll("\{.*?\}","")}}

That just replaces anything surrounded with { } and it's contents. Works for us as long as no one uses curly braces in their email (which I've never seen before)

 

Cheers!

0 votes
Deleted user October 10, 2017

I haven't seen this before but mail clients showing HTML source rather than processed HTML usually occurs if the HTML isn't valid.

Since the comment is used directly by default, you could try escaping the comment? Something like:

{{#htmlEncode}}{{issue.comments.last.body}}{{/}}

should do the trick

Larry Barker October 12, 2017

Thanks for the reply Mark,

I gave this a shot and unfortunately it was still coming through in the same manner.   I've just changed everything to standard text for now to clean it up.  

Cheers,

Larry

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events