- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 08:13 AM
Hey everyone,
I’m trying to use a value from g_scratchpad in a catalog client script, but it keeps coming back as undefined. I’ve set the scratchpad value in a Catalog Server Script on the same item.
Am I missing something?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 06:43 PM
Hello @SoniShaily
Make sure your Catalog Client Script is running after the Catalog Server Script. g_scratchpad is only available on load.
Type = onLoad for the client script.
It won’t work in onChange or onSubmit unless you store the value in a variable.
Also, double-check that your server script is actually populating the value and that it's scoped to the right item or variable set.
Thank you!
Thank You!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 08:23 AM
@SoniShaily Are you accessing it in any script other than onLoad, if yes then it is only available in onLoad and not available in onChange or onSubmit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 08:30 AM
Use g_scratchpad only in onLoad Catalog Client Scripts
Make sure your Catalog Server Script sets it properly
Don’t expect it in onChange or onSubmit without workarounds
✔️ If this solves your issue, please mark it as Correct.
✔️ If you found it helpful, please mark it as Helpful.
—
Shubham Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 08:38 AM
@SoniShaily g_scratchpad is not supported in catalog item/ Record producer as we set the g_scratchpad variables in display Business rule. Catalog server script runs when the catalog item is submitted. If you need to fetch data from server, then use GlideAjax call in catalog client script .
Please mark as Correct Answer and Helpful, if applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 09:00 AM
g_scratchpad works only in display business rule and won't work on catalog side.
what's your business requirement?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader