- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2020 02:56 AM
Difference between GlideAjax , getreference and g_scratchpad ? When to use ? Could anybody expalin wid example or scenario
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2020 03:09 AM
Glide Ajax
The GlideAjax class allows the execution of server-side code from the client. GlideAjax calls pass parameters to the script includes, and, using naming conventions, allows the use of these parameters.
https://docs.servicenow.com/bundle/paris-application-development/page/script/ajax/topic/p_AJAX.html
Get Reference
you can use the getReference() to glide that particular record from client side and access the related record of that Glide Object, you can find the more details here: GlideForm - Client
https://www.servicenowguru.com/scripting/client-scripts-scripting/gform-getreference-callback/
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.
https://community.servicenow.com/community?id=community_question&sys_id=7971cb29db98dbc01dcaf3231f9619d9
Regards
Pranav

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2020 03:09 AM
Glide Ajax
The GlideAjax class allows the execution of server-side code from the client. GlideAjax calls pass parameters to the script includes, and, using naming conventions, allows the use of these parameters.
https://docs.servicenow.com/bundle/paris-application-development/page/script/ajax/topic/p_AJAX.html
Get Reference
you can use the getReference() to glide that particular record from client side and access the related record of that Glide Object, you can find the more details here: GlideForm - Client
https://www.servicenowguru.com/scripting/client-scripts-scripting/gform-getreference-callback/
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.
https://community.servicenow.com/community?id=community_question&sys_id=7971cb29db98dbc01dcaf3231f9619d9
Regards
Pranav

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2020 03:53 AM
To explain simply,
GlideAjax will only fetch specified data like specified columns in a table using asynchronous call.
getReference will fetch the entire record. Will tables with many columns, fetching the entire row will degrade instance's performance.
g_scratchpad is used with Display Business Rule to save a data in a temporary memory storage on a server that a form can access. Display Business Rule executes before the form is displayed so this is the best way. However, the form must be using the same table that the display business rule is using. For example, "Incident" form.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2020 03:12 AM
Hi
Hope you are doing good.
Is this question resolved or you need some more assistance?
if your query is resolved then please mark the correct response so that this thread can be closed.
Regards
Pranav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 05:50 AM
Hi,
There is another one difference is GlideAjax is asynchronous and g_scratchpad is synchronous.