- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 12:43 PM
Hello Folks,
Please read the whole scenario
From Outlook their is an inbound request hitting the ServiceNow table through XML gate way, A new request is been created and the form has a field called Message(HTML type). whatever the text is added in the outlook message is been captured and stored in message field in the snow form but here comes the problem it contains the HTML tags in the message field,Major requirement Message field in the form should be HTML type but all the text which is been captured from Outlook should be Tag free text. So what is the best way to get rid of this HTML tags..???
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 03:57 PM
Here's a code sample using RegEx that will remove HTML tags. Use what ever body text you want in the 'body' variable.
var regex = /(<([^>]+)>)/ig;
var body = "<p>test</p>";
var result = body.replace(regex, "");

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 03:57 PM
Here's a code sample using RegEx that will remove HTML tags. Use what ever body text you want in the 'body' variable.
var regex = /(<([^>]+)>)/ig;
var body = "<p>test</p>";
var result = body.replace(regex, "");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2020 11:01 AM
Those three lines just saved me hours of aggravation. Thanks Chuck!