How to use RP .getParameterValue to fill a Reference field in a catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2017 07:54 AM
I have a catalog item with 3 fields that should be pre-filled from the Call form
Using the following in the "Default Value" of the variable I am able to get two "Single Line Text" fields to populate correctly
javascript: var answer = RP.getParameterValue("sysparm_sh_des"); answer;
BUT it does not work for my Reference type variables.
This is the script I am attempting to use as the default value for the Reference field - I assume it should be "sysparm_company" since "company" is the name of the field on the Call form I am pulling from.
javascript: var answer = RP.getParameterValue("sysparm_company"); answer;
Side note: I am modifying a Catalog Item that was created by someone else initially who has left. I am not familiar with the RP . gerParameter scripts and I am not sure where to point the sysparm value
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2017 08:02 AM
You can create an onLoad script and set the values. See this article for instructions:
Edit: I found this article that has other examples on how to do it server side:
How To Get Parameters/Values From a URL in ServiceNow | SN Commander
Hopefully one of these options will work for you. You could put the script in a script include and call that via the default value.