Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# The Glide User (g_user) is a global object available within the client side. It provides information about the logged-in user.

Property Description

g_user.userID Sys ID of the currently logged-in user
g_user.name User's Full name
g_user.firstName User's First name
g_user.lastName User's Last name

# It also has some methods available within the client side.

Method Description

g_user.hasRole() Determine whether the logged-in user has a specific role
g_user.hasRoleExactly() Do not consider the admin role while evaluating the method
g_user.hasRoles() You can pass two or more roles in a single method
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
if (g_user.hasRole('admin') || g_user.hasRole('itil')) {
// User has at least one of the roles
g_form.setDisplay('internal_notes', true);
}

if (g_user.hasRole('admin') && g_user.hasRole('itil')) {
// User must have both roles
g_form.setDisplay('advanced_settings', true);
}

//Using the parameters to set a field value
g_form.setValue('short_description', g_user.firstName);

g_form.setValue('short_description', g_user.lastName);

g_form.setValue('short_description', g_user.name);

g_form.setValue('short_description', g_user.userID);
Loading