Where is "g_scratchpad" saved?

bonsai
Mega Sage

I plan to use "g_scratchpad" for development from now on.

The main use is to read system properties in display business rules,
I plan to create and store some variables in "g_scratchpad".

Is it possible to store large amounts of data?
Also, is the data stored in "g_scratchpad" saved on the client side (temporary storage area of the browser, etc.)?

1 ACCEPTED SOLUTION

Harish Bainsla
Tera Sage
Tera Sage

Using g_scratchpad in ServiceNow is a good practice for storing temporary data that needs to be shared across client-side scripts, such as client scripts and UI policies. However, there are some important considerations regarding its limitations and where the data is stored:

  1. Size Limitation: g_scratchpad is not suitable for storing large amounts of data. It's meant for small and temporary data storage. There is no specific size limit defined for g_scratchpad, but it's not designed for storing large datasets or files. If you need to store and manage large amounts of data, consider using tables or other appropriate storage mechanisms in ServiceNow.

  2. Client-Side Storage: The data stored in g_scratchpad is maintained on the client side, specifically within the user's browser. This means it's temporary and only persists as long as the user's session is active. When the user logs out or closes their browser, the data in g_scratchpad is cleared. It's not a server-side storage mechanism and should not be used for long-term data retention.

https://youtu.be/WHdmXmEdCMY?si=hqfI8BuG2MYtxpJm

View solution in original post

In this video we will see the what is g_scratchpad object, its uses and a demo. You can utilize them in Display Business Rule and onLoad Client script. What are Business Rules in ServiceNow? (Complete Demo) https://youtu.be/9nRA6KwpsHc Please subscribe to my channel ...
2 REPLIES 2

Harish Bainsla
Tera Sage
Tera Sage

Using g_scratchpad in ServiceNow is a good practice for storing temporary data that needs to be shared across client-side scripts, such as client scripts and UI policies. However, there are some important considerations regarding its limitations and where the data is stored:

  1. Size Limitation: g_scratchpad is not suitable for storing large amounts of data. It's meant for small and temporary data storage. There is no specific size limit defined for g_scratchpad, but it's not designed for storing large datasets or files. If you need to store and manage large amounts of data, consider using tables or other appropriate storage mechanisms in ServiceNow.

  2. Client-Side Storage: The data stored in g_scratchpad is maintained on the client side, specifically within the user's browser. This means it's temporary and only persists as long as the user's session is active. When the user logs out or closes their browser, the data in g_scratchpad is cleared. It's not a server-side storage mechanism and should not be used for long-term data retention.

https://youtu.be/WHdmXmEdCMY?si=hqfI8BuG2MYtxpJm

In this video we will see the what is g_scratchpad object, its uses and a demo. You can utilize them in Display Business Rule and onLoad Client script. What are Business Rules in ServiceNow? (Complete Demo) https://youtu.be/9nRA6KwpsHc Please subscribe to my channel ...

I understand!
thank you!