- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 03:42 AM
Hi! I was wondering if there's any recommendations and best practices around the use of session.putClientData()?
I'm embedding three widgets into a service portal header menu. And instead of loading them all for each page load using $sp.getWidget, I store each widget in their own session data cache instead.
This is several seconds faster to load. Each widget's data ranges from around 60-100kb or so.
Does anyone think this is a terrible idea? The docs doesn't say anything about the recommended size of the data to put into client data. So I don't want to generate performance issues by doing this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 04:13 AM
Hi @Vegard S ,
We do not have any doc as such which tells the recommended Size.
session.putClientData()
method in ServiceNow:-
Use the
getSession()
methodUse thegetSession()
method of the scoped GlideSystem API instead ofGlideSession
. -
Use
GlideSession.getClientData()
Use theGlideSession.getClientData()
method to retrieve data values that were set usingputClientData()
.
- Wrapping code in functions
- Running only necessary client scripts
- Avoiding using GlideRecord queries in client side scripts
- Avoiding using synchronous AJAX methods in client side scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 04:13 AM
Hi @Vegard S ,
We do not have any doc as such which tells the recommended Size.
session.putClientData()
method in ServiceNow:-
Use the
getSession()
methodUse thegetSession()
method of the scoped GlideSystem API instead ofGlideSession
. -
Use
GlideSession.getClientData()
Use theGlideSession.getClientData()
method to retrieve data values that were set usingputClientData()
.
- Wrapping code in functions
- Running only necessary client scripts
- Avoiding using GlideRecord queries in client side scripts
- Avoiding using synchronous AJAX methods in client side scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 04:16 AM
Ok, I'm well within all of this. And it's not a huge amount of data we're talking about.
I'm gonna let this thread be open for a day or two, just in case anyone has some feedback I should know about 🙂