File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Client-Side Components/Client Scripts/Get Logged in User Information Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ # The Glide User (g_user) is a global object available within the client side. It provides information about the logged-in user.
2+
3+ Property Description
4+
5+ g_user.userID Sys ID of the currently logged-in user
6+ g_user.name User's Full name
7+ g_user.firstName User's First name
8+ g_user.lastName User's Last name
9+
10+ # It also has some methods available within the client side.
11+
12+ Method Description
13+
14+ g_user.hasRole() Determine whether the logged-in user has a specific role
15+ g_user.hasRoleExactly() Do not consider the admin role while evaluating the method
16+ g_user.hasRoles() You can pass two or more roles in a single method
Original file line number Diff line number Diff line change 1+ if ( g_user . hasRole ( 'admin' ) || g_user . hasRole ( 'itil' ) ) {
2+ // User has at least one of the roles
3+ g_form . setDisplay ( 'internal_notes' , true ) ;
4+ }
5+
6+ if ( g_user . hasRole ( 'admin' ) && g_user . hasRole ( 'itil' ) ) {
7+ // User must have both roles
8+ g_form . setDisplay ( 'advanced_settings' , true ) ;
9+ }
10+
11+ //Using the parameters to set a field value
12+ g_form . setValue ( 'short_description' , g_user . firstName ) ;
13+
14+ g_form . setValue ( 'short_description' , g_user . lastName ) ;
15+
16+ g_form . setValue ( 'short_description' , g_user . name ) ;
17+
18+ g_form . setValue ( 'short_description' , g_user . userID ;
You can’t perform that action at this time.
0 commit comments