- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2018 06:09 AM
Hi ,
I am writing a script on UI macro where I have to open a url when I click on the button. All working good except the below line of code where the system is not rendering the below line when the form loads.
Code:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<td align="left">
<button id="createEnq" onClick="onCreateEnq();">Create Enquiry</button>
<script>
function onCreateEnq()
{
var reqFor = g_form.getValue('caller');
var location =g_form.getValue('caller.location');
var reqItem = 'e4595d8edbe8b240a35dba9ffe96197a';
var comments1 = g_form.getValue('short_description');
var comments2 = g_form.getValue('description');
var comments=comments1+comments2;
var bs=g_form.getValue('u_business_service');
var OwnedGroup=getValue('u_owned_by');
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + reqItem +'&sysparm_user=' + reqFor + 'sysparm_location=' + location + 'sysparm_comments=' + comments+'sysparm_bs='+bs+'sysparm_OwnedGroup='+OwnedGroup;
window.open(url)
}
</script>
</td>
</j:jelly>
Error while loading form: The reference to entity "sysparm_user" must end with the ';' delimiter.
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + reqItem +'&sysparm_user=' + reqFor + '&sysparm_location=' + location + '&sysparm_comments=' + comments+'&sysparm_bs='+bs+'&sysparm_OwnedGroup='+OwnedGroup;
Could you please help me on this ASAP?
Regards,
Yasar
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2018 10:39 AM
Change this to
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + reqItem +'&sysparm_user=' + reqFor + '&sysparm_location=' + location + '&sysparm_comments=' + comments+'&sysparm_bs='+bs+'&sysparm_OwnedGroup='+OwnedGroup;
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2018 10:39 AM
Change this to
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + reqItem +'&sysparm_user=' + reqFor + '&sysparm_location=' + location + '&sysparm_comments=' + comments+'&sysparm_bs='+bs+'&sysparm_OwnedGroup='+OwnedGroup;
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 11:49 AM
What was changed?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2018 10:42 AM
Can you try this instead
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + reqItem +'&sysparm_user=' + reqFor + '&sysparm_location=' + location + '&sysparm_comments=' + comments+'&sysparm_bs='+bs+'&sysparm_OwnedGroup='+OwnedGroup;
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2018 07:39 PM
This seems to work fine for me, but if you are having issues I'd guess it has to do with the '&' pieces in your 'url' variable string. That typically needs to be escaped properly to work in Jelly. I'd try replacing each of those with '${AMP}' or '$[AMP]' and see if that helps.
Check out this doc for more details.
https://docs.servicenow.com/bundle/kingston-application-development/page/script/general-scripting/concept/c_ExtensionsToJellySyntax.html#ariaid-title15