- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 02:50 PM
I'm trying to capture the url parameter 'sysparm_comments' but I get the error 'ReferenceError: GlideURL is not defined'
What options do I have to capture the url 'sysparm' values from the url on Portal.
FYI: I cannot switch the type to 'Desktop' because I want it to work on the Portal
Here is my catalog client script code:
function onLoad() {
var gUrl = new GlideURL();
gUrl.setFromCurrent();
var comments = gUrl.getParam("sysparm_comments");
alert('comments');
}
url: https://<instance>/sp?id=cat_item&sys_id=6a8497441b99b4106c45b886d34bcb37&sysparm_comments=testing%20passing%20information
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 03:02 PM
Hi,
GlideUrl won't support here use the parse URL parameters in the client script.
Copy the same code from the below link and change the argument as per your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 03:02 PM
Hi,
GlideUrl won't support here use the parse URL parameters in the client script.
Copy the same code from the below link and change the argument as per your requirement.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 06:21 AM
The link is not available anymore.
Could you please share the solution again?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 03:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 03:56 PM
Thanks Balaji,
There was some additional code at the bottom which worked fine. Here is the full code:
function onLoad() {
var comments = getParameterValue("sysparm_comments");
alert(comments);
}
function getParameterValue(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(top.location);
if (results == null) {
return "";
} else {
return unescape(results[1]);
}
}