The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to parse a table from text field in an issue into a table in an email using A4J

Dave Furlani
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 Champions.
April 19, 2023

We have a Jira Service Management project that often has tables pasted into a text field.

When using that field in an email action in A4J, the table appears like the confluence wiki mark-up for a table, e.g.

|| heading || heading ||

| text | text |

| text | text |

 

What I'm hoping to do in A4J is parse that into HTML so the table appears correctly in the email that A4J sends. 

Can any one suggest a way?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Dave Furlani
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 Champions.
March 12, 2024

So, turns out there's a .html option, but depending on what's in the table in the field can produce some ugly results with badly aligned text.  

Field output from {{customfield_10347}}

download.png

Output from {{customfield_10347.html}} which the forum won't let me include, looks very vanilla and should just produce a very plain table. Sadly, it doesn't.

 

Which sadly appears in Outlook like this, which seems to be extra line feed chars added as part of the .html option for each pipe char in the original mark-up that displays a table in Jira/Confluence.:

Screenshot 2024-03-13 093448.png

By adding in the .replaceAll I was able to remove the unwanted new lines, and then use a few .replace to change the styling to something more like I wanted 

{{customfield_10347.html.replaceAll("(\n)","").replace("'table-wrap'>","'table-wrap' style='font-family: calibri, arial, sans-serif; font-size: 11px; border-collapse: collapse; text-align: left; vertical-align: top;'>").replace("'confluenceTh'>","'confluenceTh' style='color: #fff; background: #204b87; padding: 5px; height=15;'>").replace("'confluenceTd'>","'confluenceTd' style='color: #fff; background: #204b87; padding: 5px; height=15;'>")}}

 

Dave Furlani
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 Champions.
March 12, 2024

Wow. Took me a year of distractions to finally get enough time to sort out my own problem. I hope that helps someone one day

TAGS
AUG Leaders

Atlassian Community Events