Any UseCase of g_scratchPad in servicenow??

SandeepKSingh
Kilo Sage
 
3 ACCEPTED SOLUTIONS

Not applicable

@SandeepKSingh In ServiceNow, g_scratchpad is a special object used to store temporary data that can be accessed across client-side and server-side scripts within the same transaction. It is often used in UI Scripts, UI Actions, Business Rules, Client Scripts, and Script Includes to pass data between scripts, especially when there is a need to share data across different script types in a single transaction.

Scenario: You want to retrieve a user's Manager and Department information on the server-side (via a Business Rule) and pass this information to a Client Script to dynamically display it on the form.

There are many articles to explain with code as well just search in community.

 

View solution in original post

Rajesh Mushke
Mega Sage

Hi @SandeepKSingh,

 

Refer the below video to understand the use case easily. It is very well demonstrated in the video.

https://www.youtube.com/watch?v=LclUuP-gSNw 

https://www.youtube.com/watch?v=77D7DMIaG24 

View solution in original post

In this video, you will learn three ways of getting data from server on Client. You will learn about: - g_scratchpad - getReference() - GlideAjax Our Website: https://www.saaswithservicenow.in Our Facebook Page : https://www.facebook.com/saaswithservicenow Our Discord: https://discord.gg/mcevNeE ...
g_scratchpad object is used to pass information from service to client. I this video i have provided the brief demo that how we can use g_scratchpad in servicenow and how we can use g_scratchpad object in display business rule (server side) and in client script (client side). Please visit below ...
5 REPLIES 5

Not applicable

@SandeepKSingh In ServiceNow, g_scratchpad is a special object used to store temporary data that can be accessed across client-side and server-side scripts within the same transaction. It is often used in UI Scripts, UI Actions, Business Rules, Client Scripts, and Script Includes to pass data between scripts, especially when there is a need to share data across different script types in a single transaction.

Scenario: You want to retrieve a user's Manager and Department information on the server-side (via a Business Rule) and pass this information to a Client Script to dynamically display it on the form.

There are many articles to explain with code as well just search in community.

 

Not applicable

Hello @SandeepKSingh ,

 

g_scratchPad is temporary variable used to pass data from server to client.

Use case : There should be at least one attachment available on the form.

- In this case we should write display BR to get if attachment is available or not.

- We can access variable in client script and give alert to user that "no attachment present "

Refer below article for details,

https://www.servicenow.com/community/itsm-articles/quot-use-of-server-side-script-g-scratchpad-and-c...

 

Thanks,

Valmik Patil

Rajesh Mushke
Mega Sage

Hi @SandeepKSingh,

 

Refer the below video to understand the use case easily. It is very well demonstrated in the video.

https://www.youtube.com/watch?v=LclUuP-gSNw 

https://www.youtube.com/watch?v=77D7DMIaG24 

In this video, you will learn three ways of getting data from server on Client. You will learn about: - g_scratchpad - getReference() - GlideAjax Our Website: https://www.saaswithservicenow.in Our Facebook Page : https://www.facebook.com/saaswithservicenow Our Discord: https://discord.gg/mcevNeE ...
g_scratchpad object is used to pass information from service to client. I this video i have provided the brief demo that how we can use g_scratchpad in servicenow and how we can use g_scratchpad object in display business rule (server side) and in client script (client side). Please visit below ...