We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

URLSearchParams and custom Service Catalog URL parameters with sysparm_ prefix

GLewis5
Tera Guru

I have seen a lot posts regarding the use of URLSearchParams in Catalog Client Scripts to extract custom parameter values from a URL. In all the examples, the names of the custom parameters start with "sysparm_".  As best I can tell, this prefix is not required when introducing a custom URL parameter. Why does everyone use a "sysparm_" prefix?

 

1 ACCEPTED SOLUTION

Not applicable

Hello @GLewis5 

 

Exactly, one doesn't need to use sysparm. PFB below example - 

 

    //Use the 'getParameterValue' function below to get the parameter values from the URL   
var par = getParameterValue('name of paramter in URL');

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]);
    }
}

  

View solution in original post

1 REPLY 1

Not applicable

Hello @GLewis5 

 

Exactly, one doesn't need to use sysparm. PFB below example - 

 

    //Use the 'getParameterValue' function below to get the parameter values from the URL   
var par = getParameterValue('name of paramter in URL');

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]);
    }
}