document.URL.parseQuery() suggestion to replace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 01:25 PM
We are getting tagged in Health Check for var url = document.URL.parseQuery(); as DOM manipulation issue. Looking for suggestions to replace 'var url = document.URL.parseQuery();' in client script
- Labels:
-
Best Practices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 01:46 PM
A user answered a similar question here:
Re: How to get entire URL in Client Script OR sysparm
Here is a deep dive:
IMO, using DOM to snag the url will always be supported but I understand the need to be in full compliance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2019 09:58 AM
I have created a catalog client script to grab the URL parameters on a catalog item coming from NEW CALL. I have written the client script the same way the OOB client script "Propose a new Standard Change Template" is written but I cannot get the parameters out of the URL.
Here's my client script:
I've also tried it without trying to get two parameters (just the Requested For)
Any ideas why this doesn't work but the Standard Change Template client script does? Only difference I can find is the Change Template is a Record Producer, not a Catalog Item.
Here's my URL:
/nav_to.do?uri=%2Fcom.glideapp.servicecatalog_cat_item_view.do%3Fsysparm_id%3D0f3534a4db29b7007f24e415ca9619fb%26sysparm_reqFor%3D3df0f1c11bc0fb00b2eea60d2d4bcb5d%26sysparm_location%3D%26sysparm_details%3DNEW_CALL_REF%253ACALL0004731%2Blkjljlkj%26sysparm_stack%3Dnew_call.do%3Fsys_id%3Dfd77669adb2dbb00171cfd333996195c%26sysparm_stack%3Dnew_call_list.do%3Fsysparm_query%3Dactive%3Dtrue%26sysparm_contact_type%3Dphone
function onLoad() {
var reqFor = getParmVal2('sysparm_reqFor');
var details = getParmVal2('sysparm_details');
if (reqFor){
g_form.setValue('variables.requested_for', reqFor);
}
if (details){
if (g_form.getControl('description'))
g_form.setValue('description', details);
}
}
function getParmVal2(name){
var url2 = document.URL.parseQuery();
alert("URLName=" + url[name]);
if(url2[name]){
//We never get here
return decodeURI(url2[name]);
}
else{
return;
}
}