- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 09:43 PM
How to get current logged in user userid in client script? I don't want sys_id i want userid
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 09:54 PM
you can use g_user object and this line to get userid/user name
g_user.userName
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 09:54 PM
you can use g_user object and this line to get userid/user name
g_user.userName
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 11:50 AM
how to get Phone number in this case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 09:46 PM
Hi @Ram050670
Please try out below code, it should work on client side (UI Policy or Client Script):
var gr = new GlideRecord('sys_user');
gr.get(g_user.userID);
var phone = gr.phone;
Please mark this answer helpful, if it worked for you.
Thanks
Fazal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2025 09:26 PM
Hi @Akki1
You can use the g_user object to fetch logged in user details like firstname/ fullname etc.
g_user.userID