Help on Jelly escaping.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2017 01:35 PM
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>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2017 03:25 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2017 03:46 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2017 03:42 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2017 06:58 PM
Thanks R0b0.