
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2020 12:02 PM
We are starting to implement the ITSM Agent Workspace and would like to pass the the opened for variable on the interaction record to a variable in the catalog item form. How can you pass a variable from the interaction record in the Agent Workspace to the catalog item when an agent presses the create request button on the interaction record?
Thank you in advance for any tips or tricks!
Example Steps:
1. First an interaction record is created for a user and then the "Create Incident" button is pressed
2. The service catalog it opened from the "Create Request" button. We then select a catalog item (Smart Hands in this case).
3. Finally the catalog item (Smart hands) is opened and currently displays the logged in user, but we would like to pass the variable over from the interaction record.
Solved! Go to Solution.
- Labels:
-
Agent Workspace
- 5,348 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2020 02:52 PM
We figured it out. Below is an example script on how to get a user from an interaction in agent workspace and apply it to a requested for field on a catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2020 10:50 AM
What type of script was this? Was it on the UI Action or something else?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2021 03:04 AM
Hello,
I'm trying to accomplish something similar, passing a variable from a case to a catalog item variable.
But it is not working.
I created a scrip under Systems Definitions, Client Scripts but is not doing anything:
function onLoad() {
//Type appropriate comment here, and begin script below
var reqLocation = localstorate.getItem("u_site_acronym");
if(reqLocation)
g_form.setValue('Location', reqLocation);
localStorage.clear();
}
Any advice?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2020 02:12 PM
If you want to know more about local storage in the browser, you can view the API here:
https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
Basically you will want to do the following steps:
- Create a client script that loads the local storage when your form field is changed:
//Get the value of the name field var name = g_form.getValue('name'); //Set the name field to a "name" variable on the browser's storage localStorage.setItem('name', name);​
- On the form you want to set a field you will want to have an onLoad client script to grab the value and then clear the value after you have used it:
//Get name value from local storage var name = localStorage.getItem('name'); //Set the name field from local storage g_form.setValue('name',name); //Clear the local storage localStorage.removeItem('name'); ​
Also if you need to clear all of the storage you have been using you can use the clear() function:
// Clear all items
localStorage.clear();
Let me know if you have any other questions!
Best,
Forrest

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2023 03:31 PM
If you are only interested in passing the "created for" from an interaction to the requested item's "requested for", be sure that the user is matched by a role on glide.sc.req_for.roles property, or glide.sc.req_for.roles.default = allow rather than deny.
You can refer to https://docs.servicenow.com/bundle/utah-servicenow-platform/page/product/service-catalog-management/...