Comments (5)
  • Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

1 MirekD commented Permalink

Thanks for this instruction.
Really helped me solve this issue, however the script itself is not 100% correct.
The call for cleanText method should have 2 parameters: "LD = HTML.cleanText(LD, False)"
Second thought I had about it is, although it works great for description_longdescription in SR, it does not solve the issue with other inbound plain text communication to existing tickets.
So I removed this script and I created a similar one on MSGBODY attribute in INBOUNDCOMM object:

from psdi.util import HTML
if not (MSG.startswith('<html>')):
MSG = HTML.cleanText(MSG, False)
Works like a charm.

2 PeteHalbeisen commented Permalink

Miroslaw, <br /> Sorry to be so long in responding. <br /> You're welcome and we appreciate your feedback. I'll try this out and encorporate it into the post. <br /> Thanks, <br /> Pete

3 MirekD commented Permalink

Thanks Pete, <br /> Unfortunately I had to modify that script once again. I found one major issue, so I had to add one line of code to it: <div>&nbsp;</div> from psdi.util import HTML <div>&nbsp;</div> if not (MSG.startswith('')): <br /> if not (HTML.isHtml(MSG)): <br /> MSG = HTML.cleanText(MSG, False) <br /> MSG = MSG + HTML.RICH_TEXT_MARKER

4 Barbara Fierro commented Permalink

If you have Offerings used in Self Service Center where the long_description field is editable, you may need to modify this script further because it will not be interpreted as Interactive and therefore will add the markers. This is what we found to work: <div>&nbsp;</div> if mbo is not None: <br /> ownerMbo = mbo.getOwner() <br /> if ownerMbo is not None: <br /> ownerName = ownerMbo.getName() <br /> if not interactive and ownerName == 'INBOUNDCOMM': <br /> if not (LD.startswith('')): <br /> LD = HTML.cleanText(LD) <br /> LD = LD + HTML.RICH_TEXT_MARKER

5 Yalcin Kumbasar commented Permalink

Hi All. In case you may have another need related to rich texts such as writing whole or parts of LD rich text to a common text field, you can use the toPlainText(str) method of psdi.util.HTML in order to remove unwanted html tags etc. <div>&nbsp;</div> ldtext = mbo.getString("DESCRIPTION_LONGDESCRIPTION"); <br /> ldtext = HTML.toPlainText(ldtext);