- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 05:16 PM
I would like get the view name from the URL through a catalog script , I have the current script but I'm getting the following error message :
TypeError: Cannot read properties of null (reading 'URL')
function onLoad() {
var view = getParm('view');
if (view.toString() == 'review2') {
g_form.setValue('u_earb_request_type','review2');
g_form.setReadOnly('u_request_name',false);
g_form.setReadOnly('u_assigned_lead',false);
g_form.setReadOnly('u_client_name',false);
}
}
function getParm(value) {
var url = document.URL.parseQuery();
if (url[value]) {
return decodeURI(url[value]);
} else {
return;
}
}
Solved! Go to Solution.
- 1,952 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 12:01 PM
Can you try below code as is in your onLoad script once.
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("view");
return value; //this will give you the value
if (value.toString() == 'review2') {
g_form.setValue('u_earb_request_type','review2');
g_form.setReadOnly('u_request_name',false);
g_form.setReadOnly('u_assigned_lead',false);
g_form.setReadOnly('u_client_name',false);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2022 03:06 AM
Hi Mike,
can you show me the URL from which you are trying to fetch data

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 12:01 PM
Can you try below code as is in your onLoad script once.
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("view");
return value; //this will give you the value
if (value.toString() == 'review2') {
g_form.setValue('u_earb_request_type','review2');
g_form.setReadOnly('u_request_name',false);
g_form.setReadOnly('u_assigned_lead',false);
g_form.setReadOnly('u_client_name',false);
}
}
}