
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2020 10:34 AM
I'm having to update business rules created by someone else, and struggling with one part: how to retrieve a sysparm value from the service catalog request url.
The first business rule script captures Call info and builds a url populated by its form values. The parameter in question is e.g. sysparm_work_notes="work notes here".
The last two lines of the first script then navigate to the relevant service catalog:
action.setRedirectURL(url);
current.isNavigateToCatalog = true;
The user then inputs values for the REQuest. This is working fine.
The second business rule hands the Call info off to the new REQuest. Most of the javascript works as expected except for retrieving sysparm_work_notes. I've tried several methods and every one of them causes my script to abort (with no alerts or errors) when the command or function is called. Two resources with code that failed for me are:
https://www.servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/?unapproved=105494&moderation-hash=6d9bb48e1bcaf8ba1b82d3a37e9eb47e#comment-105494
https://community.servicenow.com/community?id=community_question&sys_id=85e68fa5db1cdbc01dcaf3231f96198c
Specifically, the following suggested lines of code each cause my script to abort:
var wn = getParameterValue(‘sysparm_work_notes’);//uses function(s) from first link
var href = window.location.href;
var href = this.location.href;//recommended alternative to window; neither works for me
var par = $sp.getParameter("sysparm_work_notes");
I'm fairly new to ServiceNow development and I know I'm missing something re client vs server side scripting. Anyway, bottom line, I just need a method that works. I've spent days searching and testing... help?
EDIT:
I also tried the following based on another rec, and it also aborts:
var map = gs.action.getGlideURI().getMap();
var par = map.get('sysparm_work_notes').toString();
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2020 04:41 PM
managed to solve this myself thanks to stumbling on another community topic. The working code is:
var par = gs.action.getGlideURI().getMap().get('sysparm_catalog'); //get parameter from URL
(I had to use sysparm_catalog as a work-around since for unknown reasons work_notes wasn't surviving the trip)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2020 04:41 PM
managed to solve this myself thanks to stumbling on another community topic. The working code is:
var par = gs.action.getGlideURI().getMap().get('sysparm_catalog'); //get parameter from URL
(I had to use sysparm_catalog as a work-around since for unknown reasons work_notes wasn't surviving the trip)