How to get the sys_id of logged in user to the Portal?

sndev1099
Giga Expert

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.

1 ACCEPTED SOLUTION

rad2
Mega Sage

Use g_user.userID (without brackets). This should work in client scripts

Ex:

var user = g_user.userID; 

View solution in original post

5 REPLIES 5

userID is a property and not a method which is why we dont use (). 

For more information have a look at these links - 

https://old.wiki/index.php/GlideUser_(g_user)

https://developer.servicenow.com/app.do#!/lp/new_to_servicenow/app_store_learnv2_scripting_jakarta_t...