g_scratchpad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2019 06:28 PM
Hi Team,
Can someone explain me where the value is displayed in the form after we retrieve the value from g_scratchpad using client script, NOTE: g_scratch pad is used to get the value from the server which is not there in the client end. So after we get the value from g_scratchpad will it create a field in the client form to display the value which is fetched from the g_scratchpad or this will display like a popup.
Also want to know if there is client/server synchronization then why we cannot directly pull the info using client script rather than using g_scratchpad.?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2019 06:39 PM
g_scratchpad is a simple javascript object where you can get/set properties. You can get/set these properties on the client in client scripts. You can also set these properties in an ondisplay Business rule, and those properties will be available on the client in that single page load.
As far as I know, g_scratchpad cannot be used to set values on the client and have them available on the next server interaction. They are useful for passing details down to the client from the server on initial load of the form without having to do a GlideAjax call back to the server.
It is up to you what you decide to do with that data you pass down in g_scratchpad, but Servicenow doesn't automatically put them into any field or alert the user, it is up to you how you want to use it.
Does that answer your question?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2019 08:11 PM
for example, If i don't have a filed "email" in a form but that is a hidden component in my form layout. So, if I want to get the value in that email address do I have to use g_scratchpad?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2019 08:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2019 08:44 PM
My Question is what information does the client need from the server to use g_scratchpad, a simple example can you define me?