- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-09-2018 06:32 AM
Hi All,
I want to get the logged in user in my client script which I will be running on a catalog item.
This script should support both Service Portal view and Application view
When using g_user.getUserID in client script, it works fine in Application view but in Service Portal it gives me an error - TypeError: g_user.getUserID is not a function.
Is there an alternate solution for this? Since I am using client script, gs.getUserID() is not accepted.
Thanks and Regards,
Vishnu
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-09-2018 06:36 AM
There should be no problem with this, but I believe you want 'g_user.userID'.
Please mark this response correct if I've answered your question. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-09-2018 06:36 AM
There should be no problem with this, but I believe you want 'g_user.userID'.
Please mark this response correct if I've answered your question. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-09-2018 06:45 AM
Hi Mark,
Perhaps today is my lucky day since you were online and saw my question.
Yes g_user.userID fixed the issue. I was using g_user.getUserID which worked fine in application view.
Thanks a lot for the reply.
P.S: Your articles on ServiceNow Guru are amazing too

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-09-2018 06:46 AM
Thanks Vishnu! I'm glad you've got it working. š
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago