Get sysparm value from URL in a list control
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 12:35 AM
I have a list control for that I want to customize so if a specific sysparm(sysparm_nonew) appears in the url, I want to hide the new button.
But I can't find how get get the sysparm_nonew from the url. I tried "gs.action.getGlideURI().getMap().get('sysparm_nonew')" but will only return null no matter if I got sysparm_nonew=true eller not in the URL.
Any ideas?
//Göran
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 12:46 AM
Hi Goran,
Are you doing this in client side
if yes then here is the code
var rec_sys = getParmVal('sysparm_nonew'); // this contains the value
if(rec_sys != null) {
alert(rec_sys);
}
function getParmVal(name){
var url = document.URL.parseQuery(); // this gives the window url
if(url[name]){
return decodeURI(url[name]);
}
else{
return;
}
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 12:52 AM
As I'm writing about, I'm doing this in a list control. So it's server side.
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 12:51 AM
Hi Goran,
These links would be helpful:
How To Get Parameters/Values From a URL in ServiceNow | SN Commander
Finding the sys_id of a record — ServiceNow Elite
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 01:04 AM
Hmm..I think I know what the problem is thou. If I use like "gs.action.getGlideURI().toString()" I get -> api/now/v2/ui/init_list/change_request?api=api and not the "real URL"... that is why my other first test didn't work either with gs.action.