GlideSession: When to use get/setProperty versus get/putClientData
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 07:16 AM
When would I select gs.getSession.getProperty and .putProperty versus gs.getSession().getClientData and .setClientData?
Is there a relationship between the getSession property methods and instance properties?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 08:10 AM
The getClientData() and putClientData() methods allow you to set data in the user's session from a server-side script using putClientData(), and then retrieve that data using getClientData().
This functionality can be extremely useful for passing data back-and-forth between the server and client, without performance-costly synchronous queries or time-consuming Ajax calls.
You can get the Browser details from a user sessions like below
gs.getSession().getProperty('user_agent_browser'); // For browser
gs.getSession().getProperty('user_agent_version'); // for browser version
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 08:22 AM
Sachin
Thank you.
What default properties are set beyond browser name and version?
If I put my own name in the property, I can put and get those values.
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 03:51 PM
In effect, why use property versus client data?
// ---------------- ----------- -------------------------------------- -----------
// Jim Kerrigan 03-Sep-2020 Initial coding STRY0012345
// ---------------- ----------- -------------------------------------- -----------
//
// Query about GlideSession.
//
// Set some constants.
propertyName = 'custName' + 'Property';
propertyValue = 'Harry' + 'Property';
clientDataName = 'custName' + 'ClientData';
clientDataValue = 'Harry' + 'ClientData';
//
// Retrieve the session object.
var session = gs.getSession();
//
// Set the values.
session.putProperty ( propertyName, propertyValue );
session.putClientData ( clientDataName, clientDataValue );
//
// Show the values.
gs.info ( propertyName + ' propertyValue value should be ' + propertyValue + ': ' + session.getProperty ( propertyName ) );
gs.info ( clientDataName + ' clientDataValue value should be ' + clientDataValue + ': ' + session.getClientData ( clientDataName ) );
//
// That's all.
*** Script: custNameProperty propertyValue value should be HarryProperty: HarryProperty
*** Script: custNameClientData clientDataValue value should be HarryClientData: HarryClientData
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 11:37 AM
Session has properties on it, put there by processes prior to and during/after login. Where are those properties documented?