Ampersand in Jelly AKA the curse of 99 Monkey Tails... need help...

Tom Sienkiewicz
Mega Sage

Hi there,

I am stuck for a good few hours with encoding the ampersand in Jelly so please if anyone knows a solution help me out

Basically I have a dynamic content block with two-phase Jelly.

The bit of code I am having trouble with:

<?xml version="1.0" encoding="utf-8" ?>

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

[...]

  <script>

[...]

 

  //INCIDENTS

  function openInc() {

  alertarray[2] = 0;

  $j('#gsft_main').attr('src', '/' + tables[1] + '$[AMP]sysparm_query=' + sources[2] + '^EQ');

  }

  function openInc2() {

  alertarray[3] = 0;

  $j('#gsft_main').attr('src', '/' + tables[1] + '$[AMP]sysparm_query=' + sources[3] + '^EQ');

  }

[...]

  </script>

</j:jelly>

I try to set the SRC for the iFrame to be a filtered list of incidents.

In the Chrome console, the src looks like this:

1.PNG

In ServiceNow, the iFrame gets rendered like this:

2.PNG

where does that @99@ even come from???

I tried everything - ${AMP}, $[AMP], &amp;amp, even setting Jelly variable with <j:set> and passing it to the Javascript, everytime either the whole code gets broken and the block does not render at all or I get this weird @99@ output.

I really hope someone had a similar situation and managed to solve it? any suggestions? thanks!

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Tomasz,



Ampersand is not the right character and your URL is malformed, which could be part of the issue.



Try going to incident_list.do?sysparm_query...


View solution in original post

2 REPLIES 2

Chuck Tomasi
Tera Patron

Hi Tomasz,



Ampersand is not the right character and your URL is malformed, which could be part of the issue.



Try going to incident_list.do?sysparm_query...


I just realized the same thing hah! Thanks though for your swift assistance, as always



Yeah the issue must have been not the Jelly encoding but the rendering of the URL itself.