How to put a URL that includes a sys_id in an <a href> in a UI Page hyperlink?

patricklatella
Mega Sage

Hi all,

I've creatd a UI Page to show a popup on a record producer in our CMS portal that includes a hyperlink to our CSM Service Portal.  I want the link to take the user directly to a specific record producer in the CMS Service Portal.  However if I try to put the URL which includes a sys_id (for example: "/csm_portal?id=sc_cat_item&sys_id=33105b12dbb6bf00cf29f3931d961918"), the system doesn't allow the sys_id in the HTML script of the UI Page.  Is there some formatting I'm missing?  thanks! 

Here's my UI Page HTML script:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<table width="100%">
<tr>
<td>
<div style="margin-top:20px; margin-bottom:20px; font size:10px" class="text-center"><font size='5'>To report an issue please create a Case in our CSM Portal. <br><br>Click <a href="/csm_portal?id=sc_cat_item&sys_id=33105b12dbb6bf00cf29f3931d961918" target="_blank"><font color='blue'>$[SP]here</font></a>$[SP]to be directed to the correct form.</br></br></font>
</div>
</td>
</tr>
</table>
</j:jelly>

and when I save it I get this error:

find_real_file.png

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Patrick,

you would require to escape the & character because of which it is not working; replace it with &amp; it should work

<a href="/csm_portal?id=sc_cat_item&amp;sys_id=33105b12dbb6bf00cf29f3931d961918" target="_blank">

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Manish Vinayak1
Tera Guru

Hello,

You need to escape the "&" character; replace "&" with "&amp;" and it should work.

Change your URL to:

/csmportal?id=sc_cat_item&amp;sys_id=your_sys_id_here

 

You can also use ${AMP} to insert an ampersand in Jelly. Here's the link to the documentation on that:

https://docs.servicenow.com/bundle/newyork-application-development/page/script/general-scripting/con...

 

Give it a try and let me know how you go.

Hope this helps!

Cheers,

Manish

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Patrick,

you would require to escape the & character because of which it is not working; replace it with &amp; it should work

<a href="/csm_portal?id=sc_cat_item&amp;sys_id=33105b12dbb6bf00cf29f3931d961918" target="_blank">

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

patricklatella
Mega Sage

thanks guys...that was it!