Help on Jelly escaping.

vks
Kilo Expert

Hi all,

Could you tell me if which of the statements in below Jelly script for a UI page require escaping and how to achieve it?

Thanks in advance,

Vipin

<?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 text = "";

text += gs.getProperty("myProperty");

var rec = new GlideRecord("my_scope_my_table");

var numberToCheck = "ABC01001"; // hardcoded

rec.addQuery("number", numberToCheck);

rec.query();

if(rec.next())

{

  var temp = rec.text.toString();

      text += temp;

  gs.info(text);

}

</g:evaluate>

</j:jelly>

4 REPLIES 4

Ivano B
ServiceNow Employee
ServiceNow Employee

Hi Vipin



Please have a look to this article



http://wiki.servicenow.com/index.php?title=How_to_Escape_in_Jelly#gsc.tab=0



Cheers


R0b0


Hi,



Thanks for the reply. I had looked at that article and various other posts and I understand that if my input has any of the special chars, I need to escape them. However my script above isn't dealing or manipulating any of these special chars. All I'm doing is reading from table columns and manipulating strings.



So I'm not sure if my my script needs escaping or not and if it does then do I need to put every assignment statement in g:element as tag?



Thanks,


Vipin


Ivano B
ServiceNow Employee
ServiceNow Employee

Hi Vipin



Maybe I'm wrong but I don't think you need any escape.


Usually in case you have a server side code executed into g:evaluate you have to look for statements where < or > is used.


In that case you need to escape otherwise the interpreter will evaluate the syntax as start or end of a tag.


I can't see anything like this in your code.



Cheers


R0b0


Thanks R0b0.