To get current logged in user details using client script Glide Ajax

vijay T1
Tera Contributor

To get current logged in user details using client script Glide Ajax

4 REPLIES 4

Astik Thombare
Tera Sage

Hi @vijay T1 ,

 

Could you please elaborate it more ?

 

Thanks,

Astik Thombare

Hi  @Astik Thombare,

 

To get current logged in user details using client script Glide Ajax

Like if we select the user then we need to get the user's email, location and department.

Cold you please help me on this.

Harish KM
Kilo Patron
Kilo Patron

Hi @vijay T1 you can get this directly in onLoad client script, no need script include unless you want to get user details

script:

var userID = g_user.userID;
   alert('Current user ID = ' + userID);

 

Reference : https://developer.servicenow.com/dev.do#!/reference/api/vancouver/client/c_GlideUserAPI#r_GlideUserU...

Regards
Harish

Aman Kumar S
Kilo Patron

You can always use g_user user object for this which is supported in client side scripts:

Follow below cheat sheet for client side server user attributes that can be used:

https://servicenowguru.com/scripting_user-object-cheat-sheet/

 

Best Regards
Aman Kumar