Can I set a g_scratchpad variable on a catalog client script for later use?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 10:20 AM
I have an onLoad client script that looks like... (onchange of remit_to variable)
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_scratchpad.holder = newValue;
}
I can't alert g_scratchpad.holder though. Is g_scratchpad not meant to be used this way?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 10:51 AM
Nope, i don't think so.
WF scratchpad is stored in the WF context and can be fetched whenever.
client scratchpad is used in situation where you do a check on Server side and what to pass that into a client script.
example.. check if ticket has attachments. - display BR to query sys_attachment. count the number of attachments...save in scratchpad.
create client script that check scratchpad value to do...something.
i would guess the scratchpad is cleaned out after every save/update
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 11:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 11:20 AM
Scratchpad is a data holder which is on server and client side
Server - Display Business Rule to put data in scratch pad
Client - Read data from scratch pad and use it
https://docs.servicenow.com/bundle/madrid-application-development/page/script/business-rules/concept/c_ScriptingWithDisplayBusinessRules.html
but i`m thinking about that business case, if you would need to reuse some data you can always have sort of placeholder variable hidden from users on a form with a string type where you can store data for future use i.e. in JSON format.
maybe its not best practice but would work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2019 11:42 AM
The problem right now is I'm using the <insert expletive> Multi-Row-Variable-Set.
When I invoke a row, I have a client script that requires pulling info from the main catalog item form.
But that doesn't seem to be able to leverage any of the variables outside the variable set.
#WeepingAndGnashingOfTeeth