Jelly - Displaying Translated HTML field in its formatted HTML on UI Page

kristenankeny
Tera Guru

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?

1 ACCEPTED SOLUTION

kristenankeny
Tera Guru

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.

View solution in original post

6 REPLIES 6

kristenankeny
Tera Guru

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.

When I was looking for a reason why the no_escape did not work for you, I stumbled on this article: https://community.servicenow.com/community?id=community_blog&sys_id=b62da6e5dbd0dbc01dcaf3231f9619a8...

If you check the first comment by Göran followed by the comment of stephenn, stephenn presents an issue with phase 1 no_escape, concretly your page will fail if the text contains &amp;. Just try adding "&" in your HTML field and see what happens, normally it causes the page to fail.