- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 06:19 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 07:01 AM
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]);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 07:01 AM
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]);
}
}