- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2024 10:09 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2024 10:12 PM
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2024 10:53 PM - edited ‎11-10-2024 10:54 PM
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
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2024 11:22 PM
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2024 10:12 PM
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2024 10:15 PM - edited ‎11-10-2024 10:16 PM
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,
Thanks,
Valmik Patil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2024 10:20 PM
Please refer the below link.
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2024 10:53 PM - edited ‎11-10-2024 10:54 PM
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
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke