- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2018 01:04 PM
Everything I'm finding says that <g2:no_escape> should work to display a kb article's text field (a translated HTML field) in its formatted form (so This is bold instead of <b>This is bold</b>), but it's not working for me. This is the snippet of the jelly:
<div style="padding-left:40px">
<b><h3><div style="color:#6f6f6f">$[kbArt.u_outline_order] $[kbArt.short_description]</div></h3></b>
<div style="padding-left:10px"><g2:no_escape>$[kbArt.text]</g2:no_escape></div>
</div>
This is however, resulting in the html code being displayed instead. Where am I going wrong?
Solved! Go to Solution.
- 3,275 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2018 06:38 AM
I was able to resolve the issue by changing all j2 and g2 tags to j and g. I'm not positive why this worked, but it did and that's all I care about.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2018 01:54 PM
The OOB UI Macro displaying knowledge article uses <g2:no_escape>$[NS:knowledgeRecord.text]</g2:no_escape>.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2018 02:01 PM
Thanks for the suggestion. I had checked an OOB UI page, but not the UI macros. Unfortunately this is also a no go - still getting the html code and not the formatted text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2018 05:42 PM
Thats weird, does your OOB kb_view page works correctly?
Here is a simple UI Page I tried in an OOB instance to try it out:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g2:evaluate>
var kbArt = new GlideRecord('kb_knowledge');
kbArt.get('24d9243187032100deddb882a2e3ec33');
</g2:evaluate>
<div style="padding-left:40px">
<b><h3><div style="color:#6f6f6f">$[kbArt.short_description]</div></h3></b>
<div style="padding-left:10px"><g2:no_escape>$[kbArt.text]</g2:no_escape></div>
</div>
</j:jelly>
It renders as HTML content without any issue, maybe this is related to a system property you switched (however I could not find anything related to that).
Could you check to make sure your text is not stored as escaped HTML. With the example knowledge article I provided, you would go in "Scripts - Background" menu and run the following:
var kbArt = new GlideRecord('kb_knowledge');
kbArt.get('24d9243187032100deddb882a2e3ec33');
gs.print(kbArt.text);
Then check the output to see if it is printed like <b>bold</b> or like <b>bold</b>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2018 06:56 AM
It's giving me <b>Bold</b>