Jira Automation: Jira html links show as text in email

Hunter1428 March 9, 2021

Hi all,

I'm using the Jira automation plugin with a html email template I created.

I have noticed that html links which are in description or comments get converted to just text in the email. I guess I understand why this is, because it does not contain the html info.

Is there a way for these links to retain there html formatting? 

Thanks!

2 answers

1 accepted

3 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 10, 2021

Hi @Hunter1428 

Would you please provide an example of your automation rule's email content that is not keeping the formatting?  Thanks!

Best regards,

Bill

Hunter1428 March 15, 2021

Hi @Bill Sheboy 

Rule: when ticket enters status submitted send email to x (HTML Format)

I'm using the smart key {{issue.fields.description}} to get the description. When you create/update a ticket with a link in the description, the email is sent. But the hyperlink is not present on the link in the email.

 

Here is the basics of the HTML template:

<table style="margin-left: auto; margin-right: auto;" width="50%" cellspacing="0" cellpadding="0"><tbody><tr><td style="width: 552px; vertical-align: top; text-align: left;"><table style="width: 100%; margin-left: auto; margin-right: auto;" cellspacing="0" cellpadding="0"><tbody><tr><td>&nbsp;</td></tr><tr><td style="background-color: #e0e0e0;"><h3>Description</h3></td></tr><tr><td><hr /></td></tr></tbody></table><table style="width: 100%; margin-left: auto; margin-right: auto;" cellspacing="0" cellpadding="0"><tbody><tr style="height: 13px;"><td style="text-align: left; height: 13px;"><span style="color: #333333;"> {{issue.fields.description}} </span></td></tr></tbody></table></td></tr></tbody></table>

 

Regards

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2021

Thanks, @Hunter1428 

Is there any text missing from the Description in the email, or is it otherwise complete?

Have you tried {{issue.description}} removing the fields prefix to see how that impacts the formatting?

Hunter1428 March 16, 2021

Hey @Bill Sheboy 

There is no text missing, all is present in the email.

I just replaced {{issue.fields.description}} with {{issue.description}}, created a new ticket with a HTML link in (confirmed it was a html link by clicking it) submitted the ticket. Received the email and the link is indeed still just text, no HTML :(

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 16, 2021

Gotcha.  Please try this to force the description to be usable in HTML content:

{{issue.description.htmlEncode}}

Hunter1428 March 16, 2021

Unfortunately did not work.

I created a new rule just to send the description of a ticket with a HTML link and still only shows as text.

Maybe this also helps, bullet point formatting is also strange. Instead of it showing as points or numbers it shows as * instead.

Pic of rule.

image1.JPG

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 16, 2021

Sorry I missed the issue here..it appears that the automation rule engine does not yet process the wiki markup from the fields in Jira.  Here are the related things in the suggestion backlog:

As a work-around, I have hard-coded my actual HTML in emails within rules.  For example to produce a list of issues from a Lookup Issues action:

Here is the list:
<ul>
{{#lookupIssues}}
<li><a href="{{url}}">{{key}}</a> : {{summary}}</li>{{/}}
</ul>

This means that if you could parse the linked or other formatted information from the Description, you could use HTML to recode it yourself.  Quite the hassle but it might solve the problem for you. 

Like # people like this
Hunter1428 March 17, 2021

No worries, but thanks for the links and list information!

I noticed on https://codebarrel.atlassian.net/browse/AUT-2050 it mentions you can use {{issue.descriptíon.html}}. I tried it and it does work but it's adding double line spacing between each line. Maybe you have an idea?

Like Dave Furlani likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2021

Hi, @Hunter1428 

Great find!  Two things to try:

Under the email options, I disabled "Convert line breaks to HTML line breaks" and it removed the extra line breaks when I used {{issue.description.html}}

Next, if that doesn't fully work, you could hack-up the converted HTML:

  • First, echo {{issue.description.html}} to the audit log to see what you are getting in your converted mark-up
  • If you find something you don't want, use .replace() to substitute (or add) other HTML.  For example, you could add font size or color changes to the tags.
Like # people like this
Hunter1428 March 17, 2021

Hi, @Bill Sheboy 

Turning off "Convert line breaks to HTML line breaks" worked great!

Problem is fully solved it seems. I tested it with some emails with different format styles and so far they all worked as expected. 

Thanks for the help!

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2021

I am glad to hear that helped!

Dave Furlani June 5, 2023

Semi-related, the replace can be used to format tables appearing in the wiki format in large text fields like Description, to produce formatted HTML tables that appear as desired in emails. For example, adding a border, padding, and a heading row with a background:

{{customfield_10192.html.replace("<table","<table cellspacing='0' bordercolor='#B7B7B7' border='1' cellpadding='5' style='font-family:arial align:left;'").replace("'confluenceTh'>","'confluenceTh' BGCOLOR='#3A89C9'>")}}

Please forgive my poor HTML. I hope I haven't triggered anyone   =o)

Like Bill Sheboy likes this
2 votes
Cameron Stubber May 27, 2021

Hi All,

Just wanted to share, that disabling the "Convert line breaks to HTML line breaks" also solved some problems I was having.

My issue was that the HTML Email was correct in terms of content and font/color - but there were huge blocks of br being inserted and spacing things down the page way too far.

Unticking this option and it looks exactly as expected when opened in the browser as an html file.

Marc Isikoff December 6, 2022

I am trying this in non cloud version (our company just puts JSD Server in our cloud, not Atlassian)

Anyway I have the description of the issue with a url that if I click on that in the issue it renders an image.

I then tried sending an email by using:

{{issue.description.html}} and it did not render an image at all (not even a dead link)

Also disabling line breaks in an HTML format makes for a paragraph instead of neatly spaced lines, so leaving that checked for now.

Suggest an answer

Log in or Sign up to answer