- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 04:02 AM
Hi,
Can anyone help me in getting the sys_id of the logged in user on the service portal?
I'm creating a catalog client script and I need to get the sys_id of the currently logged in user but g_user.userID(); isn't working. Will I need to use GlideAjax here?
Any help would be great.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 04:12 AM
Use g_user.userID (without brackets). This should work in client scripts
Ex:
var user = g_user.userID;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 04:12 AM
Hi,
You have write following piece of code on server side:
data.user = gs.getUserID()
and call it in either HTML using {{data.user}}or on client side using c.data.user
Regards,
Munender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 04:37 AM
Thanks! Managed to get this working just using g_user.userID;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 04:12 AM
Use g_user.userID (without brackets). This should work in client scripts
Ex:
var user = g_user.userID;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 04:36 AM
That worked! Thank you. Can you explain why having the brackets wouldn't work?