Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Extract text from knowledge

Kalaiarasan Pus
Giga Sage

Is there a easy way to extract the text from knowledge articles and wipe away the HTML tags as well? I am looking to convert or copy the knowledge articles HTML content to plain text.

I have already tried getHTMLValue() but the resulting text still have the HTML tags.

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

I've done this with web pages. A simple RegEx replace worked well for me.



var noHTML = rawText.replace(/<[^>]*>/g, '');

View solution in original post

3 REPLIES 3

Chuck Tomasi
Tera Patron

I've done this with web pages. A simple RegEx replace worked well for me.



var noHTML = rawText.replace(/<[^>]*>/g, '');

Hey Thanks !


But no API right OOB for this?


You are welcome.



Nothing OOB that I'm aware of. It wouldn't take much to make a UI action to do that however.