GlideURL not working in OnLoad catalog client script while trying to fetch one of the URL parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2023 03:01 AM
GlideURL not working in esc portal - OnLoad catalog client script while trying to fetch one of the URL parameters.
(There is a JavaScript error in your browser console)
Below is the OnLoad catalog client script
function onLoad() {
//Type appropriate comment here, and begin script below
var num = getParameterValue('sysparm_universal_request');
if (num) {
g_form.setValue('ur', num);
}
function getParameterValue(name) {
var url = top.location.href;
var value = new URLSearchParams(url).get(name);
if (value) {
return value;
}
if (!value) {
var gUrl = new GlideURL();
gUrl.setFromCurrent();
value = gUrl.getParam("sysparm_id");
return value;
}
}
Is there any alternative way to fetch url parameters?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2023 10:27 PM
Still getting the same error. I think the below code also need to be replaced.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2023 10:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2023 10:36 PM
Hello @sharan16
var myparm = getParmVal('sys_myparm'); function getParmVal(name){ var url = document.URL.parseQuery(); if(url[name]){ return decodeURI(url[name]); } else{ return; } }