How to store rest API JSON response in cache in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 11:30 PM
We have a requirement to update the cards on portal, for that we are using count. We get the daily visited count for the cards from external source. Our requirement is to update the cards based on the count that we received.
We have one approach - creating custom table, for storing this count. We created cards records in that table and daily we are just updating the count in that table.
But our seniors are not agreed for custom table.
Instead of custom table. They suggested us to use utility to store the data in cache. And use the data in widget.
How to to build the utility for cache?
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 12:41 AM
can I use below code in scheduled jobs is running daily . after storing in session how i can use in data on widget
var session = gs.getSession();
session.putClientData('data', "your data")
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 01:47 AM
If you only want to save the value for a few minutes because this is saving the data in the user's session, which is only available while the user is active in the session, you can use this method; otherwise, don't use it if you want to store data for a day or so.
I have already explained in my last reply how we can get the data
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
