Strip office and html tags from e-mail message

Hi

When users create an issue via e-mail, and the text has a bulleted list, some tags are still visible.
Instead of a bullet, we see: ![if !supportLists]>-          <![endif]>

I tried creating a workflow to strip this. This works if I enter the text as stated above. But it doesn't work via e-mail because the source text is different.
2 examples:

<![if !supportLists]><span style="mso-list:Ignore">-<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><![endif]>
------AND
<![if !supportLists]><span style='font-family:Symbol'><span style='mso-list:Ignore'>&middot;<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]>


The workflows don't support regular expressions.
Is there another option?

Maybe it would be better to strip all excess markup, because it retains all styling info if you edit the description:

for example:
{html}<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!–
/* Font Definitions */
@font-face
    {font-family:Wingdings;
    panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
    {font-family:Wingdings;
    panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
    {font-family:Calibri;
    panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0cm;
    margin-bottom:.0001pt;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
    {mso-style-priority:99;
    color:blue;
    text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
    {mso-style-priority:99;
    color:purple;
    text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
    {mso-style-priority:34;
    margin-top:0cm;
    margin-right:0cm;
    margin-bottom:10.0pt;
    margin-left:36.0pt;
    mso-add-space:auto;
    line-height:115%;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-fareast-language:EN-US;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
    {mso-style-priority:34;
    mso-style-type:export-only;
    margin-top:0cm;
    margin-right:0cm;
    margin-bottom:0cm;
    margin-left:36.0pt;
    margin-bottom:.0001pt;
    mso-add-space:auto;
    line-height:115%;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-fareast-language:EN-US;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
    {mso-style-priority:34;
    mso-style-type:export-only;
    margin-top:0cm;
    margin-right:0cm;
    margin-bottom:0cm;
    margin-left:36.0pt;
    margin-bottom:.0001pt;
    mso-add-space:auto;
    line-height:115%;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-fareast-language:EN-US;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
    {mso-style-priority:34;
    mso-style-type:export-only;
    margin-top:0cm;
    margin-right:0cm;
    margin-bottom:10.0pt;
    margin-left:36.0pt;
    mso-add-space:auto;
    line-height:115%;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-fareast-language:EN-US;}
span.E-mailStijl17
    {mso-style-type:personal-compose;
    font-family:"Calibri","sans-serif";
    color:windowtext;}
.MsoChpDefault
    {mso-style-type:export-only;
    font-family:"Calibri","sans-serif";
    mso-fareast-language:EN-US;}
@page WordSection1
    {size:612.0pt 792.0pt;
    margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
4 comments
Comment actions Permalink
I solved this like this, it's not perfect and possibly replaces other text:

rule Check summary for specific text

when (becomesReported() || isReported()) && (summary.changed || description.changed || comments.added.isNotEmpty) {
  var txt2find = "&lt;![if" + description.substringBetween("&lt;![if", "endif]&gt;") + "endif]&gt;";
  var txt2find2 = "<![if" + description.substringBetween("<![if", "<![endif]>") + "<![endif]>";
  var txt2replace = "- ";
  if (description.contains(txt2find, opts)) {
    description = description.replace(txt2find, txt2replace);
  }
  if (description.contains(txt2find2, opts)) {
    description = description.replace(txt2find2, txt2replace);
  }
   
  for each comment in comments.added {
    var txt2findcomment = "&lt;![if" + comment.text.substringBetween("&lt;![if", "endif]&gt;") + "endif]&gt;";
    var txt2findcomment2 = "<![if" + comment.text.substringBetween("<![if", "<![endif]>") + "<![endif]>";
    if (comment.text.contains(txt2findcomment, opts)) {
      comment.text = comment.text.replace(txt2findcomment, txt2replace);
    }
    if (comment.text.contains(txt2findcomment2, opts)) {
      comment.text = comment.text.replace(txt2findcomment2, txt2replace);
    }
     
  }
}
0
Comment actions Permalink
Apparently this doesn't work all the time. There are too many variables that are different.
0
Comment actions Permalink
Unfortunately this usability problem hasn't resolved yet - JT-22572.

Also there is an issue about regular expressions in the workflow -  JT-10718.
0
Comment actions Permalink
Thank you for pointing me to the related issues
0

Please sign in to leave a comment.