Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.

Session client data

Log in to subscribe to topics and get notified when content changes.

Session client data

Session client data is a set of named strings sent from the server to the client when a form loads. Client scripts can store this data gathered from the server during form load, which is faster than an AJAX call to the server when the data is needed.

Note: To use session client data, the form must be configured to add the Synchronous field, which requires special setup by a TSE to enable the necessary synchronous event processing.

Using session client data

A script can use session client data to determine a user's groups and group roles while the session is established. Session client data provides this information to the client script without requiring an AJAX call, thereby speeding up form load time.

When a session is established, a session.established event is added to the event queue. A script action that responds to this event can be written to set up any necessary client data for the session, as follows:

FieldSuggested Value
Name Set session client values
Event name session.established
Active Checked
Synchronous Checked
gs.getSession().putClientData('test1', 'value1');
gs.getSession().putClientData('test2', 'value2');

The GlideSession API includes:

putClientData(name, value);

When a form is created on the server, the Session Client Values are read and added to the g_user object that is created on the client. From any client script, you can use this JavaScript to get the client session data:

var v = g_user.getClientData('test1');

In this case, the variable v has a value of value1.

For examples from a ServiceNow product principal on how you can reduce client-side lookups, see the Two ways to Reduce Client Side lookups blog post in the ServiceNow Community.