Remove html tags when copying into a string field
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 03:42 AM
7 REPLIES 7

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 03:52 AM
Hi,
You need to use regex. Something as below.
var desc=current.yourhtmlfieldname; //current if used in business rule
desc= desc.replace(/<\/?[^>]+(>|$)/g, "");
Try below in background script once.
var desc='<p>test1</p>';
gs.print('Original '+desc);
desc= desc.replace(/<\/?[^>]+(>|$)/g, "");
gs.print('html sanitized:'+desc);
Output:

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2021 12:17 AM
It's also possible to use an undocumented function of GlideSPScriptable
GlideSPScriptable().stripHTML(yourHtmlStr)

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2021 07:58 PM
Hello @Martin,
How we can use this in Business rule? Can you please help with it?
Thanks,
Matang

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 03:47 AM