GlideSession - Scoped
-
- UpdatedJan 30, 2025
- 3 minutes to read
- Yokohama
- API reference
The scoped GlideSession API provides methods to find information about the current session.
There are no constructors for creating an instance of a scoped GlideSession object. Instead, use the getSession() method of the scoped GlideSystem API.
Scoped GlideSession - getClientData(String paramName)
Retrieves a session client value previously set with putClientData().
Use this method to retrieve data values that were set using the putClientData() method.
Name | Type | Description |
---|---|---|
paramName | String | Name of the client data to retrieve. |
Type | Description |
---|---|
String | Client data. |
Example
Output:
Scoped GlideSession - getClientIP()
Returns the client IP address.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | IP address. |
Example
Output:
Scoped GlideSession - getCurrentApplicationId()
Returns the application currently selected in the application picker.
This method requires admin privileges.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Currently selected application. |
Example
Output:
Scoped GlideSession - getCurrentDomainID()
Returns the sys_id of the current domain for the logged-in user session.
- If the user is configured in the global domain, and does not use the domain picker to switch domains, the method returns null.
- If the user uses the domain picker to switch to the global domain, the method returns the string "global".
- For all other domains, the method returns the sys_id of that domain.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Sys_id of the session domain of the current logged-in user. This is the same information that appears in the domain picker. |
Example
This example shows the current sys_email record's domain being set to the user's session domain, if the user domain is global or null.
Scoped GlideSession - getLanguage()
Returns the session's language code.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Session's language code. |
Example
Output:
Scoped GlideSession - getSessionToken()
Returns the session token.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Session token. |
Example
Output:
Scoped GlideSession - getTimeZoneName()
Returns the name of the session's time zone.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Name of the session's time zone. |
Example
Output:
Scoped GlideSession - getUrlOnStack()
Returns the URL on the stack. Returns null if the stack is empty.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | URL on the stack. Returns null if the stack is empty. |
Example
Output: line breaks added for clarity.
Scoped GlideSession - isImpersonating()
Returns true if the user is impersonating another user.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | Flag that indicates the user is impersonating another user. Possible values:
|
Example
Scoped GlideSession - isInteractive()
Returns true if the 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.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | Flag that indicates whether the session is interactive. Possible values:
|
Example
Scoped GlideSession - isLoggedIn()
Returns true if the user is logged in.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | Flag that indicates whether the user is logged in Possible values:
|
Example
Output:
Scoped GlideSession - putClientData(String paramName, String paramValue)
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.
Name | Type | Description |
---|---|---|
paramName | String | Name of the client data to set. |
paramValue | String | Value of the client data. |
Type | Description |
---|---|
void |
Example
Output:
On this page
- Scoped GlideSession - getClientData(String paramName)
- Scoped GlideSession - getClientIP()
- Scoped GlideSession - getCurrentApplicationId()
- Scoped GlideSession - getCurrentDomainID()
- Scoped GlideSession - getLanguage()
- Scoped GlideSession - getSessionToken()
- Scoped GlideSession - getTimeZoneName()
- Scoped GlideSession - getUrlOnStack()
- Scoped GlideSession - isImpersonating()
- Scoped GlideSession - isInteractive()
- Scoped GlideSession - isLoggedIn()
- Scoped GlideSession - putClientData(String paramName, String paramValue)