Get parameters from the URL in the Service Catalog record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2016 04:06 PM
Hello everybody. This is my first post here so apologies if I am doing anything stupid.
So, I am trying to create a service catalog record producer to take some inputs from the user (obviously) but I also need to get a parameter from the URL. I have been trying (unsuccessfully) to do this in the 'What it will contain' script section.
All the links I have found suggest this: Parse URL Parameters in a Client Script - ServiceNow Guru
When doing this however, the logs say about document not been defined in javascript. Is there any other way of getting a specific param from the URL?
The error message is here:
org.mozilla.javascript.EcmaError: "document" is not defined.
Caused by error in Record Producer: 'Add dish to Order' at line 11
8: }
9:
10: function getParmVal(name){
==> 11: var url = document.URL.parseQuery();
12: if(url[name]){
13: return decodeURI(url[name]);
14: }
Thanks for any help, it would be very much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2016 04:40 PM
The what it will contain script section of a record producer is actually a server side script.
Are you trying to pass your parameter directly to the record produced or do you want to use the parameter to automatically fill a variable inside the producer?