Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Glide User

What is a Glide User:


1. The GlideUser API provides access to information about the current user and current user
roles.
2. Using the GlideUser API avoids using the slower GlideRecord queries to get user information.
3. The GlideUser methods and properties are accessed through a global object (g_user) that is
only available in client scripts.

4. contains name and role information about the current user.


5. Glide User is typically used in client scripts and UI policies but is also found in UI actions
that run on the client.

6. cannot be used in business rules or UI actions that run on the server.

Glide User methods:

Glide User

firstName
lastName
userID
userName
getClientData()
getFullName()
hasRole()
hasRoleExactly()
hasRoleFromList()
setClientData()
hasRoles()
Glide User
1.firstName
Returns the current user's first name.
Example:

OutPut:

2.lastName
Returns the current user's lastName

OutPut:
Glide User
3.userID
Returns the sys_id of the current user.
Example:

OutPut:

4. userName
This property is the current user's username, for example gsmith02. It is not the user's name,
for example George Smith.

Example:

OutPut:
Glide User
5.getClientData()
Returns a client value set using setClientData() or GlideSession -- putClientData().

Session client data is a set of named strings that may be setup on the server
using GlideSession -- putClientData(). You can use getClientData() during form load
time to get information that the client script needs to make decisions about the
form. For example, to identify which fields should be visible.

Example:

OutPut:

6.getFullName()
Returns the first and last name of the current user.

Example:

OutPut:
Glide User
7.hasRole()
Returns true if the current user has the specified role or the admin role.

Example:

OutPut:

7. hasRoleExactly()
Determines whether the current user has the specified role.

Example:

OutPut:
Glide User
8. hasRoleFromList()
Returns true if the current user has at least one of the specified roles or has the admin role.

Example:

OutPut:

9. setVlientData()
Sets a client value that you can retrieve using getClientData().

Example:
Glide User

10.hasRoles()
Returns true if the current user has any role.

Example:

OutPut:

You might also like