ServiceNow : g_scratchpad vs GlideAjax

Iqbal Mohd
Servicenow Tutorial
2 min readMay 26, 2018

Manipulation between server side and client side scripting. User experience, speed and practicality.

So what is it? Well essentially it is a way to pass data from the server to the client without using GlideAjax. The data that you pass through is delivered as part of the rendered page. This is a form of server rendering technology. The data is being shared between the server and the client.

It’s extremely useful for delivering data that there’s a high chance you’ll need (or definitely need) but isn’t there by default. For example, you might want to know the user’s manager, their location, the number of tickets assigned to them etc.

The other way of retrieving this data would be after the form is loaded to perform a GlideAjax back to the server asking for those details making the user wait for them before seeing the results and letting them move on with the process — I’ve seen this too many times and it’s not a nice experience.

How to use it?

For example, create business rule;onDisplay to trigger the condition and fired g_scratchpad function.

if(current.short_description = 'Medium.com'){
g_scratchpad.isTrue = 'true';
}

And after that create a client script;onLoad to perform an action

if(g_scratchpad.isTrue = 'true'){
g_form.setReadOnly('description',true); //set field read only
}

--

--

Iqbal Mohd
Servicenow Tutorial

Programmer - A person who fixed a problem that you don`t know you have , in a way you don`t understand. 3 years experience in programming with HSBC and SINGTEL.