Glide Session
What is Glide Session
and Usage
The Glide Session API allows us to find information about
the current session
Glide Session API
provides a way to find information on current session.
Glide Session Methods
Glide
Session |
|
clearClientData() |
isLoggedIn() |
getClientData() |
putClentData() |
getLanguage() |
getTimeZoneName |
getRoles() |
isInteractive() |
Work with these all methods |
1.
Navigate to System
Definition
2.
Open Scripts –
Background Application
3.
Write code into given space
1. Working with getClientData () method
Returns a session client value previously set with putClientData ().
This method is used in a client script to retrieve data values that were
set by a server script that used the putClientData
() method.
Code
var myData = gs.getSession ();
myData.putClientData('userName','Srinivas');
var clientData = session.getClientData('userName')
gs.print (clientData);
2. Working with clearClientData () method
Clears a session
client value previously set with putClientData().
This method is used in a client script to clear data values that were set
by a server script using the putClientData
() method.
Code
var myData = gs.getSession ();
myData.putClientData('userName','Srinivas');
var clientData = session.getClientData ('userName');
gs.print(clientData);
session.clearClientData ('userName');
clientData =
session.getClientData('userName');
gs.print (clientData);
3. Working with getLanguage () method
This method is used to gets the session's language code.
Code
var session = gs.getSession ();
var language = session.getLanguage();
gs.info (language);
4. Working with getRoles () method
This method is used to gets a list of roles for the current logged in user.
The list of roles does not reflect any changes made during the current
user session. To get the updated list of roles, the user must log out and log
back in.
gs.info (gs.getSession ().getRoles ());
5. Working
with getTimeZoneName() method
This method is used to
gets the name of the session's time zone.
Code
var session= gs.getSession ();
var timeZone = session.getTimeZoneName();
gs.print (timeZone);
6. Working
with isInteractive () method
Determines if the current session is
interactive.
Code
var interActive =
gs.getSession().isInteractive();
gs.info (interActive);
7. Working
with isInteractive () method
Determines if the current user is currently
logged in.
Code
var session = gs.getSession ();
var loggedIn = session. IsLoggedIn ();
gs.info (loggedIn);
8. Working with putClientData () method
Sets a session client value that can be retrieved with getClientData (). This method is used
in a server side script that runs when a form is created.
Code
var session = gs.getSession();
var clientData = gs.putClientData('userName','Srinivas')
gs.print (clientData);
Thanks for sharing such quality information.
ReplyDeleteServiceNow Online Training in Hyderabad
Servicenow Online Training in India