- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2019 07:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2019 10:27 PM
Hello Hit,
#g_scratchpad: The g_scratchpad object passes information from the server to the client, such as when the client requires information not available on the form. For example, if you have a client script that needs to access the field u_retrieve, and the field is not on the form, the data is not available to the client script. A typical solution to this situation is to place the field on the form and then always hide it with a client script or UI policy. While this solution may be faster to configure, it is slower to execute.
- The g_scratchpad is an empty object you can use to push information (properties, objects, functions, etc.) from the server to the client. It is only available in display business rules and client scripts.
- It’s a one directional process, server to client
- It is only available in display business rules and client scripts. I use it a lot to populate information on the form that is typically unavailable without an Ajax call.
- Workflow activities:
- scratchpad.variableName = variableValue;
- var myValue = workflow.scratchpad.variableName;
Example:
A display business rule sends this information to the client using the following script:
g_scratchpad.css = gs.getProperty('css.base.color');
g_scratchpad.hasAttachments = current.hasAttachments();
g_scratchpad.managerName = current.caller_id.manager.getDisplayValue();
To access scratchpad data using a client script:
// Check if the form has attachments
if (g_scratchpad.hasAttachments)
// do something interesting here
else
alert('You need to attach a form signed by ' + g_scratchpad.managerName);
For detailed information about it:
https://servicenowgems.com/2016/10/10/understanding-scratchpad-g_scratchpad/
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2023 04:32 AM
can we use g_scratchpad value for 2 different tables like what if i want to populate first reported by field available on problem form with incident? is it possible with this?
Thanks
Ansh Mahajan