How to get current logged in user in server side and client side?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 09:41 AM
How to get current logged in user in server side and client side?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 09:52 AM
Hi,
Refer below link
https://www.servicenowguru.com/scripting/user-object-cheat-sheet/
Thanks,
Kunal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 10:09 AM
Hi,
Client-Side:
g_user.userID
Server-side:
gs.getUserID();
Hope this helps!
If I have answered your question, please mark my response as correct and/or helpful.
Thanks,
Sriram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 10:11 AM
Hi,
please find below lines
client script: g_user.userID
Server side: gs.getUserID()
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 09:59 AM
@Ankur Bawiskar How do I get a current logged in user's Primary Group?
I have tried a below script but it is not working
var priGrp = gs.getUserID().getRecord().getDisplayValue('primary_group');
Primary Group is Reference field.