Get current username of logged in user

ankul
Tera Contributor

Hello Everyone,

I want current username of logged in user through Glide System.

Regards

Ankul

6 REPLIES 6

thakkallapallay
Tera Contributor

Hi Ankul,


getUserName() is the method of glide system used to find current   logged in user's name. Below is the link of service-now wiki where u can find all the methods of glide system.


http://wiki.servicenow.com/?title=GlideSystem#gsc.tab=0


Rushit Patel2
Tera Guru

you can use gs.getUserName()


Mrudula6
Mega Guru

Hi Ankul,



Use gs.getUserName() to return you current logged in username. You can put this as query in GlideRecord as



ga.addQuery('user_name',gs.getUserName());



Thanks,


Mrudula


giriprasad9
Tera Expert

Hi,



Use gs.getUserName();



getUser()   Returns a reference to the User object for the current user. More information is available here.
  getUserDisplayName()   Returns the name field of the current user (e.g. John Smith, as opposed to smith).
  getUserID()   Returns the sys_id of the current user.
  getUserName()   Returns the username of the current user (for example, jsmith).


refer GlideSystem - ServiceNow Wiki



-Giri