Need Help on removing HTML tags Inbound Action

pjsnow
Kilo Expert

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..???

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

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, "");


View solution in original post

2 REPLIES 2

Chuck Tomasi
Tera Patron

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, "");


Those three lines just saved me hours of aggravation.  Thanks Chuck!