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.

How to escape special characters on UI Page? raquo

dbhertel
Tera Contributor

Hello   - on a UI Page a simple button should be able to reference special HTML characters, like the &raquo     raquo »   but when saving the UI page the XML is rejected (can't save the UI page.. XML parse rejects it).     I know the characters have to be escaped but having trouble figuring out the kludgy jelly syntax

 

HTML code works fine when not being created inside a UI page:

<a class="btn btn-primary" href="#"   >Button Label &raquo;</a>

 

I've tried variations of this syntax:   <a class="btn btn-primary" href="#"   >Button Label   ${&amp} raquo;} </a>  

 

Its probably just a escape syntax issue as described here:   How to Escape in Jelly - ServiceNow Wiki but haven't found the secret sauce to do this.     Shouldn't be this hard to make work.........


 

Any help appreciated....

1 ACCEPTED SOLUTION

User140988
Kilo Guru

Hi dbhertel,



Use the below method : I have given a small script to display a button with label "Terms & Conditions" with an ampersand in between. Declare a jelly variable as shown below and you can call this jelly variable where ever necessary in the jelly tags:



<j2:set var="jvar_amp" value="&amp;"/>


<button> Terms $[jvar_amp] conditions </button>



When this UI page content is tried, a button comes up with "Terms & conditions" as label.


View solution in original post

2 REPLIES 2

User140988
Kilo Guru

Hi dbhertel,



Use the below method : I have given a small script to display a button with label "Terms & Conditions" with an ampersand in between. Declare a jelly variable as shown below and you can call this jelly variable where ever necessary in the jelly tags:



<j2:set var="jvar_amp" value="&amp;"/>


<button> Terms $[jvar_amp] conditions </button>



When this UI page content is tried, a button comes up with "Terms & conditions" as label.


dbhertel
Tera Contributor

Thank you -- appreciate you sharing the secret sauce



I've combined the jelly variable with the 'raquo" directly after the jelly var and it renders the special char correctly. Thanks!