
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 10:38 PM
I need to do some validation on an html field, checking the source html, but everything I have tried has not allowed me to get at the actual html. e.g if I have an html field where the source code is:
<p><strong>here we are testing</strong></p>
which displays in the field as:
here we are testing
anything I do in a business rule or client script returns just the text, i.e:
here we are testing
How can I get at the source html, i.e. including all of the html tags?
I'm hoping I am just missing something really obvious...?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2020 01:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 10:54 PM
Hi,
So you want to get the value of html field with the tags as well
I tried this in background script and it gave me the complete html source code
Example script is for knowledge table
var gr = new GlideRecord('kb_knowledge');
gr.get('207de43187032100deddb882a2e3ec7a');
var html = gr.getValue('text');
gs.info(html);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2020 01:54 PM
Thanks Ankur, I found the answer last night, I'm now using current.text.getHTMLValue()
Your suggestion does also work so have marked as helpful

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2020 01:53 PM
current.text.getHTMLValue() works, returns the html source code