Displaying HTML with Jelly in a UI page

jdurden
Kilo Explorer

So, I went into this project thinking this was going to be pretty straight forward. And, maybe it is. But what I thought should work intuitively isn't working as I anticipated and the information I'm finding online isn't working.

What I'm trying to do is display some HTML (on a UI Page) which is stored in a variable. Example...



<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate>
var test = "<b>this is bold</b>";
</g:evaluate>

${test}
</j:jelly>


In case it's not clear, the desired outcome is to have a simple bold text "this is bold" display on the UI Page when visited. However, when you visit the page it looks like:

<b>this is bold</b>


Clearly the HTML is being encoded at some point in this whole thing and, despite searching forums and Google, I'm unsure how to fix it. Any ideas?


Thanks in advance!

25 REPLIES 25

Shane J
Tera Guru

Just found this after posting my issue, but this doesn't help me entirely.

  • I can't seem to make this work without the record already having been saved. <--This is the bigger issue.
  • When I do use <g:no_escape>, anything that is formatted in some way loses the spaces around it.

Any ideas?

 

My post:

https://community.servicenow.com/community?id=community_question&sys_id=96999422dbbb77cc23f4a345ca96...