---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideSession - Global

# GlideSession - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes to read

The GlideSession API provides methods to find information about the current session.

## GlideSession - clearClientData(String paramName) {#ariaid-title2}

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.
{#r_GlideSessionClearClientData_String__table_aw2_rsq_ks__entry__3}

| Name | Type | Description |
|-|-|-|
| paramName | String | Name of the client data to clear. |
[Table 1. Parameters]

{#r_GlideSessionClearClientData_String__table_aw2_rsq_ks} {#r_GlideSessionClearClientData_String__table_bw2_rsq_ks__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 2. Returns]

{#r_GlideSessionClearClientData_String__table_bw2_rsq_ks}  

    var session = gs.getSession();
    session.putClientData('custName', 'Harry');
    var clientData = session.getClientData('custName');
    gs.info(clientData);
     
    session.clearClientData('custName');
    clientData = session.getClientData('custName');
    gs.info(clientData);

Output:

    Harry
     
    null

## GlideSession - getClientData(String paramName) {#ariaid-title3}

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.
{#r_GlideSessionGetClientData_String__table_s1s_k5q_ks__entry__3}

| Name | Type | Description |
|-|-|-|
| paramName | String | Name of the client data to retrieve. |
[Table 3. Parameters]

{#r_GlideSessionGetClientData_String__table_s1s_k5q_ks} {#r_GlideSessionGetClientData_String__table_t1s_k5q_ks__entry__2}

| Type | Description |
|-|-|
| String | The client data as a string. |
[Table 4. Returns]

{#r_GlideSessionGetClientData_String__table_t1s_k5q_ks}  

    var session = gs.getSession();
    session.putClientData('test1', 'Harry');
    var clientData = session.getClientData('test1');
    gs.info(clientData);

Output:

    Harry

### Scoped equivalent {#r_GlideSessionGetClientData_String__section_q2n_wgs_mcb}

To use the getClientData() method in a scoped application, use the
corresponding scoped method: [getClientData()](https://servicenow-prod.fluidtopics.net/w_P3_hhB18GKoyh4wkKx7g#r_ScopedGlideSessionGetClientData_String "Retrieves a session client value previously set with putClientData().").

## GlideSession - getLanguage() {#ariaid-title4}

Gets the session's language code.
{#r_GlideSessionGetLanguage__table_mc5_dvq_ks__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 5. Parameters]

{#r_GlideSessionGetLanguage__table_mc5_dvq_ks} {#r_GlideSessionGetLanguage__table_nc5_dvq_ks__entry__2}

| Type | Description |
|-|-|
| String | The session's language code. |
[Table 6. Returns]

{#r_GlideSessionGetLanguage__table_nc5_dvq_ks}  

    var session = gs.getSession();
    var language = session.getLanguage();
    gs.info(language);

Output:

    en

### Scoped equivalent {#r_GlideSessionGetLanguage__section_arv_zgs_mcb}

To use the getLanguage() method in a scoped application, use the
corresponding scoped method: [getLanguage()](https://servicenow-prod.fluidtopics.net/w_P3_hhB18GKoyh4wkKx7g#r_ScopedGlideSessionGetLanguage "Returns the session's language code.").

## GlideSession - getRoles() {#ariaid-title5}

Gets a list of roles for the current 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.
{#r_GlideSessionGetRoles__table_bk4_qvq_ks__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 7. Parameters]

{#r_GlideSessionGetRoles__table_bk4_qvq_ks} {#r_GlideSessionGetRoles__table_ck4_qvq_ks__entry__2}

| Type | Description |
|-|-|
| String | A comma separated list of roles. |
[Table 8. Returns]

{#r_GlideSessionGetRoles__table_ck4_qvq_ks}  

    gs.info(gs.getSession().getRoles());

Output:

    admin,hr_fulfiller,itsa_fulfiller,security_admin

## GlideSession - getTimeZoneName() {#ariaid-title6}

Gets the name of the session's time zone.
{#r_GlideSessionGetTimeZoneName__table_jzq_bwq_ks__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 9. Parameters]

{#r_GlideSessionGetTimeZoneName__table_jzq_bwq_ks} {#r_GlideSessionGetTimeZoneName__table_kzq_bwq_ks__entry__2}

| Type | Description |
|-|-|
| String | The name of the session's time zone. |
[Table 10. Returns]

{#r_GlideSessionGetTimeZoneName__table_kzq_bwq_ks}  

    var session = gs.getSession();
    var zoneName = session.getTimeZoneName();
    gs.info(zoneName);

Output:

    US/Pacific

### Scoped equivalent {#r_GlideSessionGetTimeZoneName__section_gcb_chs_mcb}

To use the getTimeZoneName() method in a scoped application, use the
corresponding scoped method: [getTimeZoneName()](https://servicenow-prod.fluidtopics.net/w_P3_hhB18GKoyh4wkKx7g#r_ScopedGlideSessionGetTimeZoneName "Returns the name of the session's time zone.").

## GlideSession - isInteractive() {#ariaid-title7}

Determines if the current session is interactive.
An interactive session is one that involves an end-user interacting with a user interface
that then retrieves information from a server. An example of this type of session is when a
user logs in using the log-in screen or uses a form to query a data store. A non-interactive
session is one that only involves programmatic interaction with a server such as a SOAP
request to retrieve data.
{#r_GlideSessionIsInteractive__table_j3c_mtq_ks__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 11. Parameters]

{#r_GlideSessionIsInteractive__table_j3c_mtq_ks} {#r_GlideSessionIsInteractive__table_k3c_mtq_ks__entry__2}

| Type | Description |
|-|-|
| Boolean | True if the session is interactive. |
[Table 12. Returns]

{#r_GlideSessionIsInteractive__table_k3c_mtq_ks}  
Note:  
The isInteractive() method will always return a false value for all user sessions using the classic or current mobile applications.  

    var interActive = gs.getSession().isInteractive();
    gs.info(interActive);

Output:

    false

### Scoped equivalent {#r_GlideSessionIsInteractive__section_vl5_fhs_mcb}

To use the isInteractive() method in a scoped application, use the
corresponding scoped method: [isInteractive()](https://servicenow-prod.fluidtopics.net/w_P3_hhB18GKoyh4wkKx7g#r_ScopedGlideSessionIsInteractive "Returns true if the session is interactive.").

## GlideSession - isLoggedIn() {#ariaid-title8}

Determines if the current user is currently logged in.
{#r_GlideSessionIsLoggedIn__table_kgj_ztq_ks__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 13. Parameters]

{#r_GlideSessionIsLoggedIn__table_kgj_ztq_ks} {#r_GlideSessionIsLoggedIn__table_lgj_ztq_ks__entry__2}

| Type | Description |
|-|-|
| Boolean | True if the current user is logged in. |
[Table 14. Returns]

{#r_GlideSessionIsLoggedIn__table_lgj_ztq_ks}  

    var session = gs.getSession();
    var loggedIn = session.isLoggedIn();
    gs.info(loggedIn);

Output:

    true

### Scoped equivalent {#r_GlideSessionIsLoggedIn__section_ey1_3hs_mcb}

To use the isLoggedIn() method in a scoped application, use the
corresponding scoped method: [isLoggedIn()](https://servicenow-prod.fluidtopics.net/w_P3_hhB18GKoyh4wkKx7g#r_ScopedGlideSessionIsLoggedIn "Returns true if the user is logged in.").

## GlideSession - putClientData(String paramName, String paramValue) {#ariaid-title9}

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.
{#r_GSSN-PutClientData_S_S__table_rms_lwq_ks__entry__3}

| Name | Type | Description |
|-|-|-|
| paramName | String | Name of the client parameter to set. |
| paramValue | String | Parameter value. |
[Table 15. Parameters]

{#r_GSSN-PutClientData_S_S__table_rms_lwq_ks} {#r_GSSN-PutClientData_S_S__table_sms_lwq_ks__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 16. Returns]

{#r_GSSN-PutClientData_S_S__table_sms_lwq_ks}  

    var session = gs.getSession();
    session.putClientData('test1', 'Harry');
    var clientData = session.getClientData('test1');
    gs.info(clientData);

Output:

    Harry

### Scoped equivalent {#r_GSSN-PutClientData_S_S__section_bkp_5gs_mcb}

To use the putClientData() method in a scoped application, use the
corresponding scoped method: [putClientData()](https://servicenow-prod.fluidtopics.net/w_P3_hhB18GKoyh4wkKx7g#r_ScopedGlideSessionPutClientData_String_String "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.").

