- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hello @PavanBalajT ,
g_scratchpad is an object used to pass information from a Display Business Rule to a Client Script. Since Client Scripts are "expensive" (they make the browser wait if they have to call the server via GlideAjax), the scratchpad allows you to grab the data you need while the server is already processing the record and "hand it over" to the browser in one go.
For Ex : You want to show an alert or hide a field if the user's Manager is "System Administrator," but the "Manager" field isn't on the current form.
BR script : (Display)
(function executeRule(current, previous) {
var userObj = gs.getUser().getManagerName();
g_scratchpad.managerName = userObj;
})(current, previous);
OnLoad client script :
function onLoad() {
// No need for GlideAjax or getReference!
if (g_scratchpad.managerName == 'System Administrator') {
g_form.addInfoMessage('Note: Your manager is the System Admin.');
}
}
Note : Only use g_scratchpad for Display Business Rules. While it technically exists in other types, its primary purpose is this server-to-client handoff.
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hello Pavan,
Please refer below article
Mark the article as helpful and bookmark if you found it useful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @PavanBalajT ,
To access the g_scratchpad variables from display business rule .
Business Rules run server-side. On form load, Display Business Rules execute first, followed by client-side Client Scripts.
To display form content (messages, field values, UI changes) after the Display Business Rule finishes, use g_scratchpad to pass data from server to client scripts.
In Display Business Rules, set variables like g_scratchpad.variableName = value. Client Scripts can then access them using g_scratchpad.variableName.
If my response helped, mark it as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
your question is easy.
Answer to this can be easily found on google or any AI tool
where are you stuck in case you are working on something?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hello @PavanBalajT ,
g_scratchpad is an object used to pass information from a Display Business Rule to a Client Script. Since Client Scripts are "expensive" (they make the browser wait if they have to call the server via GlideAjax), the scratchpad allows you to grab the data you need while the server is already processing the record and "hand it over" to the browser in one go.
For Ex : You want to show an alert or hide a field if the user's Manager is "System Administrator," but the "Manager" field isn't on the current form.
BR script : (Display)
(function executeRule(current, previous) {
var userObj = gs.getUser().getManagerName();
g_scratchpad.managerName = userObj;
})(current, previous);
OnLoad client script :
function onLoad() {
// No need for GlideAjax or getReference!
if (g_scratchpad.managerName == 'System Administrator') {
g_form.addInfoMessage('Note: Your manager is the System Admin.');
}
}
Note : Only use g_scratchpad for Display Business Rules. While it technically exists in other types, its primary purpose is this server-to-client handoff.
If my response helped mark as helpful and accept the solution.

