- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2017 11:33 AM
hello All,
I have a trouble removing html tags, Please read the below details and suggest the best solution.
I have a table when i select a particular template it is displaying the whole message with the html tags, I don't want the tags to be appeared on the message content. where the good part is when I press send mail the HTML tags are removed and the original message is displayed on the outlook.
Major requirement is i don't want to c the message with HTML tags on the message box when a template is selected. Please suggest a best solution, Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2017 12:17 PM
Hi Prajwal ,
You can create a new field on you table and copy the HTML text to that filed using the below script.
You have to run this as a background script.
var so=new GlideRecord('-----------------'); //your table name
so.addNotNullQuery('-------------------'); //HTML field name or add a query condition as per your requirement.
so.query();
while(so.next())
{
var a= so.unit_description.getXHTMLValue();
a= a.replace(/&(lt|gt);/g, function (strMatch, p1){
return (p1 == "lt")? "<" : ">";
});
var b = a.replace(/<\/?[^>]+(>|$)/g, "");
so.setDisplayValue('----------------------',b); // New field name
so.update();
}
- Please like or mark as correct/helpful as you see fit.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2017 10:57 AM
Check if the below thread is helpful
JavaScript: How to strip HTML tags from string? - Stack Overflow
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2017 11:10 AM
DM me on SLack @nate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2017 12:17 PM
Hi Prajwal ,
You can create a new field on you table and copy the HTML text to that filed using the below script.
You have to run this as a background script.
var so=new GlideRecord('-----------------'); //your table name
so.addNotNullQuery('-------------------'); //HTML field name or add a query condition as per your requirement.
so.query();
while(so.next())
{
var a= so.unit_description.getXHTMLValue();
a= a.replace(/&(lt|gt);/g, function (strMatch, p1){
return (p1 == "lt")? "<" : ">";
});
var b = a.replace(/<\/?[^>]+(>|$)/g, "");
so.setDisplayValue('----------------------',b); // New field name
so.update();
}
- Please like or mark as correct/helpful as you see fit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2019 06:44 AM
<p ng-bind-html="myText"></p>
It worked for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2020 03:24 AM
Hi,
//Strip HTML Tags from Comments and work notes
//Pass commnet in StripCommnet parameter.
stripHTMLTAG: function(stripComment){
stripComment = stripComment.replace(/<\/?[^>]+(>|$)/g, "");
stripComment = stripComment.replace('[code]', ' ');
stripComment = stripComment.replace('[/code]', '');
return stripComment;
},