- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2020 09:50 AM
Hello Experts can you help me out on Glide session concept/api with some example of getClientData() and putClientData()?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2020 10:22 AM
Hello Jim,
In addition to Kunal I want to add more points like
The GlideSession class has no constructor, but it is returned from the getSession() method of the GlideSystem API (gs.getSession();).
This API allows you to get and set data related to the current session.
Example usage
In business rule on the Incident table, we can place some data in the user's client session like so:
var userSession = gs.getSession();
session.putClientData('ticket_number', current.getValue('number'));
And then in a client script, you can access this data like so:
var ticketNumber = g_user.getClientData('ticket_number');
PFB Link for more reference for Can I write to a session variable from within a scoped app?
If my answer is worth to you,Please mark correct and helpful.
regards,
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2020 09:54 AM
Hi,
please check below links:
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2020 07:50 AM
Thanks for the response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2020 09:59 AM
Hi,
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.
Refer
Thanks,
Kunal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2020 10:22 AM
Hello Jim,
In addition to Kunal I want to add more points like
The GlideSession class has no constructor, but it is returned from the getSession() method of the GlideSystem API (gs.getSession();).
This API allows you to get and set data related to the current session.
Example usage
In business rule on the Incident table, we can place some data in the user's client session like so:
var userSession = gs.getSession();
session.putClientData('ticket_number', current.getValue('number'));
And then in a client script, you can access this data like so:
var ticketNumber = g_user.getClientData('ticket_number');
PFB Link for more reference for Can I write to a session variable from within a scoped app?
If my answer is worth to you,Please mark correct and helpful.
regards,
Ganesh