GlideURL not working in OnLoad catalog client script while trying to fetch one of the URL parameters

sharan16
Tera Contributor

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?