Translate special characters from Rich Text field to Plain Text Field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2022 11:28 PM
Hello Everone,
We have two fields, one custom field (rich text) and the other out of box field (plain text). We have a requirement to transfer from the rich text to the plain text field. The data is copied as HTML codes rather than the actual character.
Rich Text
1. Test for Special Character ! @ # $ % ^ & * ( ) " '
2. Test for Special Character ! @ # $ % ^ & * ( ) " '
Copied as
<p>1. Test for Special Character ! @ # $ % ^ & * ( ) " '</p>
<p><strong><span style="font-size: 12pt;">2. Test for Special Character ! @ # $ % ^ & * ( ) " '</span></strong></p>
Please guide me on how this can be resolved.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2022 11:34 PM
Hey,
Below article should help:
HOw to convert HTML to plain text in a UI Action
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2022 11:45 PM
Hi DK
there is a simple OTB method which removes HTML tags and only leaves real plain text:
new GlideSPScriptable().stripHTML(strHTML);
Just replace "strHTML" with the content of your richt text field.
Kind regards
M aik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 01:42 AM
Thanks, Maik. I can see some progress. The only challenge now is the new line is missing. All the text appears in the same line. Is there a way to resolve this?
Rich Text
1. Test for Special Character ! @ # $ % ^ & * ( ) " '
2. Test for Special Character ! @ # $ % ^ & * ( ) " '
Plain Text
1. Test for Special Character ! @ # $ % ^ & * ( ) " ' 2. Test for Special Character ! @ # $ % ^ & * ( ) " '
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 03:53 AM
Hi DK,
no, there is no clear solution for that.
The reason is, that visual line breaks in rich text fields are done by an incredible amount of different approaches. For example, via tags (<p>, <br/>, <div>), tables or CCS. By removing the HTML code, you also lose the information about line breaks.
The only way I can see is inserting line-break chars (\n) right before the most important candidates like </p>, </div> or <br/>
Kind regards
Maik